From 21380e5201f235a5f9ee9676785d08d39743aa4e Mon Sep 17 00:00:00 2001 From: Frank Busse Date: Mon, 3 Sep 2018 20:49:50 +0100 Subject: runtime: fix memory error in canonicalize_file_name Fixes #46 and reverts #47. As stated in #46, the solution works for musl, glibc etc. However, the code in stub.c is executed by uclibc and uclibc doesn't allocate the target buffer in realpath. The memory error occured while running df for 10min with DFS. --- test/Runtime/POSIX/CanonicalizeFileName.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 test/Runtime/POSIX/CanonicalizeFileName.c (limited to 'test/Runtime') diff --git a/test/Runtime/POSIX/CanonicalizeFileName.c b/test/Runtime/POSIX/CanonicalizeFileName.c new file mode 100644 index 00000000..56b02327 --- /dev/null +++ b/test/Runtime/POSIX/CanonicalizeFileName.c @@ -0,0 +1,16 @@ +// REQUIRES: not-darwin +// RUN: %llvmgcc %s -Wall -emit-llvm -g -O0 -c -o %t.bc +// RUN: rm -rf %t.klee-out +// RUN: %klee --output-dir=%t.klee-out --libc=uclibc --posix-runtime --exit-on-error %t.bc + +#define _GNU_SOURCE +#include +#include +#include + +int main(int argc, char * argv[]) { + char cwd[PATH_MAX] = {0}; + + if (!getcwd(cwd, PATH_MAX)) exit(EXIT_FAILURE); + if (!canonicalize_file_name(cwd)) exit(EXIT_FAILURE); +} -- cgit 1.4.1