diff options
author | Frank Busse <bb0xfb@gmail.com> | 2022-03-18 09:46:14 +0000 |
---|---|---|
committer | Cristian Cadar <c.cadar@imperial.ac.uk> | 2022-07-07 18:30:34 +0100 |
commit | d2f5906da4ae37a41ae257e5308d50e19689877b (patch) | |
tree | 40bb75bc1153dbf37f0df31674cf67e4af3c4da3 /runtime/POSIX/fd.c | |
parent | 99c522b14dbbf6b26be35b6e7bb8da7b29070287 (diff) | |
download | klee-d2f5906da4ae37a41ae257e5308d50e19689877b.tar.gz |
POSIX runtime: fstatat: check for nonnull path APIs
Diffstat (limited to 'runtime/POSIX/fd.c')
-rw-r--r-- | runtime/POSIX/fd.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/runtime/POSIX/fd.c b/runtime/POSIX/fd.c index 35d0d315..0aba0ade 100644 --- a/runtime/POSIX/fd.c +++ b/runtime/POSIX/fd.c @@ -568,16 +568,21 @@ int fstatat(int fd, const char *path, struct stat *buf, int flags) { return 0; } +#ifdef FSTATAT_PATH_ACCEPTS_NULL + #define PATHPARAM (path ? __concretize_string(path) : NULL) +#else + assert(path); + #define PATHPARAM (__concretize_string(path)) +#endif + #if (defined __NR_newfstatat) && (__NR_newfstatat != 0) - return syscall(__NR_newfstatat, (long)fd, - (path ? __concretize_string(path) : NULL), buf, (long)flags); + return syscall(__NR_newfstatat, (long)fd, PATHPARAM, buf, (long)flags); #else - return syscall(__NR_fstatat64, (long)fd, - (path ? __concretize_string(path) : NULL), buf, (long)flags); + return syscall(__NR_fstatat64, (long)fd, PATHPARAM, buf, (long)flags); #endif +#undef PATHPARAM } - int __fd_lstat(const char *path, struct stat64 *buf) { exe_disk_file_t *dfile = __get_sym_file(path); if (dfile) { |