X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fngircd%2Fconf.c;h=16275877a8d9e95f37cbf57ac1b395d55bb86d78;hb=62865f7e1910d08ad8d72cb89f830f6d9411ffa2;hp=372b14c0d05b87a5226c1fb531cada52681fa91d;hpb=a7dda1b28c5d425b3fc4e946ff238ca06c9bb64e;p=ngircd.git diff --git a/src/ngircd/conf.c b/src/ngircd/conf.c index 372b14c0..16275877 100644 --- a/src/ngircd/conf.c +++ b/src/ngircd/conf.c @@ -1063,7 +1063,7 @@ static void Read_Config_File(const char *File, FILE *fd) /* Read configuration file */ section[0] = '\0'; while (true) { - if (!fgets(str, LINE_LEN, fd)) + if (!fgets(str, sizeof(str), fd)) break; ngt_TrimStr(str); line++; @@ -1072,6 +1072,12 @@ static void Read_Config_File(const char *File, FILE *fd) if (str[0] == ';' || str[0] == '#' || str[0] == '\0') continue; + if (strlen(str) >= sizeof(str) - 1) { + Config_Error(LOG_WARNING, "%s, line %d too long!", + File, line); + continue; + } + /* Is this the beginning of a new section? */ if ((str[0] == '[') && (str[strlen(str) - 1] == ']')) { strlcpy(section, str, sizeof(section)); @@ -1474,7 +1480,7 @@ Handle_GLOBAL(const char *File, int Line, char *Var, char *Arg ) len = strlen(Arg); if (len == 0) return; - if (len >= LINE_LEN) { + if (len >= 127) { Config_Error_TooLong(File, Line, Var); return; }