From 3d845b6c77bf00ad08c3d0769b3e463531163aeb Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Tue, 15 Nov 2011 10:06:11 +0100 Subject: [PATCH] Consider Windows new line chars as well when parsing rule files. Bug #374. --- src/detect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/detect.c b/src/detect.c index a02bf9e3a5..47102843f2 100644 --- a/src/detect.c +++ b/src/detect.c @@ -461,7 +461,7 @@ int DetectLoadSigFile(DetectEngineCtx *de_ctx, char *sig_file, int *sigs_tot) { size_t len = strlen(line); /* ignore comments and empty lines */ - if (line[0] == '\n' || line[0] == ' ' || line[0] == '#' || line[0] == '\t') + if (line[0] == '\n' || line [0] == '\r' || line[0] == ' ' || line[0] == '#' || line[0] == '\t') continue; /* Check for multiline rules. */ @@ -479,7 +479,7 @@ int DetectLoadSigFile(DetectEngineCtx *de_ctx, char *sig_file, int *sigs_tot) { /* Check if we have a trailing newline, and remove it */ len = strlen(line); - if (len > 0 && line[len - 1] == '\n') { + if (len > 0 && (line[len - 1] == '\n' || line[len - 1] == '\r')) { line[len - 1] = '\0'; }