netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anatole Denis <anatole@rezel.net>
To: netfilter-devel@vger.kernel.org
Cc: Anatole Denis <anatole@rezel.net>
Subject: [PATCH nft] scanner: fix search_in_include_path test
Date: Mon,  2 Jan 2017 16:30:01 +0100	[thread overview]
Message-ID: <20170102153002.6711-1-anatole@rezel.net> (raw)

clang emits a warning in this function as we're using a boolean as the third
argument to strncmp. Indeed, this function only checks the first byte of the
path as is, so files beginning with . will be incorrectly included from the
current working directory instead of the include directory.

Fixes: f92a1a5c4a8761c39a76b264859f0ff2c8f71179
Signed-off-by: Anatole Denis <anatole@rezel.net>
---
 src/scanner.l | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/scanner.l b/src/scanner.l
index 625023f..bf88955 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -629,8 +629,8 @@ err:
 
 static bool search_in_include_path(const char *filename)
 {
-	return (strncmp(filename, "./", strlen("./") != 0) &&
-		strncmp(filename, "../", strlen("../") != 0) &&
+	return (strncmp(filename, "./", strlen("./")) != 0 &&
+		strncmp(filename, "../", strlen("../")) != 0 &&
 		filename[0] != '/');
 }
 
-- 
2.11.0


             reply	other threads:[~2017-01-02 15:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-02 15:30 Anatole Denis [this message]
2017-01-03 11:59 ` [PATCH nft] scanner: fix search_in_include_path test Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170102153002.6711-1-anatole@rezel.net \
    --to=anatole@rezel.net \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).