summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAnatole Denis <anatole@rezel.net>2017-01-02 16:30:01 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2017-01-03 14:21:53 +0100
commitcc0b5ec1661634dc6e2f1d3ab35a6a8650927858 (patch)
treefada0f888311a9c95883420b91cc9cc1f8c8bf3a /src
parent85d2072eccdfcb7e8045a60d8bb939de61d1c04b (diff)
scanner: fix search_in_include_path test
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: f92a1a5c4a87 ("scanner: honor absolute and relative paths via include file") Signed-off-by: Anatole Denis <anatole@rezel.net> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src')
-rw-r--r--src/scanner.l4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/scanner.l b/src/scanner.l
index 69406bd0..6b441b54 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -635,8 +635,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] != '/');
}