diff --git a/src/util-threshold-config.c b/src/util-threshold-config.c index ca720ecf23..58fee2a318 100644 --- a/src/util-threshold-config.c +++ b/src/util-threshold-config.c @@ -606,13 +606,16 @@ int SCThresholdConfLineIsMultiline(char *line) * \retval int of the line length */ int SCThresholdConfLineLength(FILE *fd) { - int pos = ftell(fd); + long pos = ftell(fd); int len = 0; int c; while ( (c = fgetc(fd)) && c != '\n' && !feof(fd)) len++; + if (pos < 0) + pos = 0; + fseek(fd, pos, SEEK_SET); return len; }