From 58f713254e504780d845f2a4c97e152cbe379846 Mon Sep 17 00:00:00 2001 From: Gerardo Iglesias Galvan Date: Tue, 31 May 2011 19:11:30 -0500 Subject: [PATCH] Make sure return value of fgetc isn't truncated --- src/util-threshold-config.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/util-threshold-config.c b/src/util-threshold-config.c index 2ca0e48557..f141d73949 100644 --- a/src/util-threshold-config.c +++ b/src/util-threshold-config.c @@ -625,7 +625,7 @@ void SCThresholdConfParseFile(DetectEngineCtx *de_ctx, FILE *fd) { char *line = NULL; int len = 0; - char c; + int c; int rule_num = 0; /* position of "\", on multiline rules */ @@ -648,7 +648,8 @@ void SCThresholdConfParseFile(DetectEngineCtx *de_ctx, FILE *fd) break; } - if (fgets(line + esc_pos, len + 1, fd) == NULL) break; + if (fgets(line + esc_pos, len + 1, fd) == NULL) + break; /* Skip EOL to inspect the next line (or read EOF) */ c = fgetc(fd);