From c968ca0f8528b86bc7c5526246dc7f1f0caf7523 Mon Sep 17 00:00:00 2001 From: Gerardo Iglesias Galvan Date: Tue, 31 May 2011 20:22:22 -0500 Subject: [PATCH] Fix potential small issue with ftell and fseek --- src/util-threshold-config.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/util-threshold-config.c b/src/util-threshold-config.c index 39be1b0ff2..a4c1d5c60e 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; char c; while ( (c = fgetc(fd)) && c != '\n' && !feof(fd)) len++; + if (pos < 0) + pos = 0; + fseek(fd, pos, SEEK_SET); return len; }