about summary refs log tree commit diff homepage
path: root/runtime
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2017-03-15 14:12:22 +0100
committerJiri Slaby <jirislaby@gmail.com>2017-03-20 11:20:02 +0100
commit73c5c452234fbd619028667b5f7a6f97741da764 (patch)
tree7c1cbe59de8e546f7bae14aea325e293108f4265 /runtime
parent2824a126cb32001bdfb0cf43ad90ba1e01c2f71f (diff)
downloadklee-73c5c452234fbd619028667b5f7a6f97741da764.tar.gz
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 <jirislaby@gmail.com>
Diffstat (limited to 'runtime')
-rw-r--r--runtime/POSIX/fd.c3
1 files changed, 3 insertions, 0 deletions
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;