From 73c5c452234fbd619028667b5f7a6f97741da764 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Wed, 15 Mar 2017 14:12:22 +0100 Subject: runtime: POSIX, check path prior dereference clang warns about check-after-use in POSIX runtime: runtime/POSIX/fd.c:573:17: warning: nonnull parameter 'path' will evaluate to 'true' on first r [-Wpointer-bool-conversion] (path ? __concretize_string(path) : NULL), ^~~~ ~ path is dereferenced in __get_sym_file before this check. So add a check to __get_sym_file and handle NULL appropriatelly by returning NULL too. Signed-off-by: Jiri Slaby --- runtime/POSIX/fd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runtime/POSIX/fd.c b/runtime/POSIX/fd.c index 24b248e3..6f78c747 100644 --- a/runtime/POSIX/fd.c +++ b/runtime/POSIX/fd.c @@ -37,6 +37,9 @@ int klee_get_errno(void); /* Returns pointer to the symbolic file structure fs the pathname is symbolic */ static exe_disk_file_t *__get_sym_file(const char *pathname) { + if (!pathname) + return NULL; + char c = pathname[0]; unsigned i; -- cgit 1.4.1