diff options
author | Cristian Cadar <c.cadar@imperial.ac.uk> | 2020-10-12 22:37:44 +0100 |
---|---|---|
committer | MartinNowack <2443641+MartinNowack@users.noreply.github.com> | 2020-11-09 19:39:13 +0000 |
commit | 4547882135af886e002d134d6bb5b510f7c73a06 (patch) | |
tree | 20b94a18421db9bd8ac0b227095fd1cbd65bb0da /test/Runtime | |
parent | dbeab5ee24c669578765783a1a8f00af7b2b52a5 (diff) | |
download | klee-4547882135af886e002d134d6bb5b510f7c73a06.tar.gz |
Test checking that __strcpy_chk is handled correctly when uclibc is used
Diffstat (limited to 'test/Runtime')
-rw-r--r-- | test/Runtime/Uclibc/strcpy_chk.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/Runtime/Uclibc/strcpy_chk.c b/test/Runtime/Uclibc/strcpy_chk.c new file mode 100644 index 00000000..c3d67079 --- /dev/null +++ b/test/Runtime/Uclibc/strcpy_chk.c @@ -0,0 +1,25 @@ +// This test checks that __strcpy_chk is properly handled when uclibc is used + +// RUN: %clang %s -emit-llvm -O2 -g -c -D_FORTIFY_SOURCE=1 -o %t2.bc +// RUN: rm -rf %t.klee-out +// RUN: %klee --output-dir=%t.klee-out --libc=uclibc --exit-on-error %t2.bc + +// RUN: %clang %s -emit-llvm -O2 -g -c -D_FORTIFY_SOURCE=2 -o %t3.bc +// RUN: rm -rf %t.klee-out +// RUN: %klee --output-dir=%t.klee-out --libc=uclibc --exit-on-error %t3.bc + +#include "klee/klee.h" + +#include <assert.h> +#include <stdlib.h> +#include <string.h> + +int main() { +#define N 3 + char *s = malloc(N); + klee_make_symbolic(s, N, "s"); + s[N - 1] = '\0'; + char *d = malloc(N); + strcpy(d, s); + assert(!strcmp(d, s)); +} |