All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nft] scanner: fix search_in_include_path test
@ 2017-01-02 15:30 Anatole Denis
  2017-01-03 11:59 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Anatole Denis @ 2017-01-02 15:30 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Anatole Denis

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH nft] scanner: fix search_in_include_path test
  2017-01-02 15:30 [PATCH nft] scanner: fix search_in_include_path test Anatole Denis
@ 2017-01-03 11:59 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2017-01-03 11:59 UTC (permalink / raw)
  To: Anatole Denis; +Cc: netfilter-devel

On Mon, Jan 02, 2017 at 04:30:01PM +0100, Anatole Denis wrote:
> 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.

Applied, thanks Anatole.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-03 11:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-02 15:30 [PATCH nft] scanner: fix search_in_include_path test Anatole Denis
2017-01-03 11:59 ` Pablo Neira Ayuso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.