Fixed buffer overflow with too long newsheader

This commit is contained in:
Michiel Broek
2003-09-02 20:25:42 +00:00
parent 43daa4cfbd
commit 8c2ce9da3b
21 changed files with 65 additions and 47 deletions

View File

@@ -310,8 +310,8 @@ void Msg_Write(FILE *fp)
char *Buf;
int i;
Buf = calloc(2049, sizeof(char));
while ((fgets(Buf, 2048, fp)) != NULL) {
Buf = calloc(MAX_LINE_LENGTH +1, sizeof(char));
while ((fgets(Buf, MAX_LINE_LENGTH, fp)) != NULL) {
for (i = 0; i < strlen(Buf); i++) {
if (*(Buf + i) == '\0')

View File

@@ -3,7 +3,11 @@
#ifndef _MSG_H
#define _MSG_H
#define MAX_LINE_LENGTH 512
/*
* Global maximum line length for all files that do something with
* message text.
*/
#define MAX_LINE_LENGTH 2048
/*