diff options
author | Thomas Jarosch <thomas.jarosch@intra2net.com> | 2016-07-30 23:40:55 +0200 |
---|---|---|
committer | Thomas Jarosch <thomas.jarosch@intra2net.com> | 2016-07-31 00:06:19 +0200 |
commit | a733a5092b404276af646b522430466df19a1612 (patch) | |
tree | eda9925b1e9b5ed5a1913e4360e4e2ebe4e264db /src/libtrace | |
parent | fixes (diff) | |
download | firejail-a733a5092b404276af646b522430466df19a1612.tar.gz firejail-a733a5092b404276af646b522430466df19a1612.tar.zst firejail-a733a5092b404276af646b522430466df19a1612.zip |
Fix wrong pointer variable in stat64 wrapper
If a program would have called stat() and then stat64(),
the traced program probably would crash
with a NULL pointer access on orig_stat64.
I've checked for similiar glitches in the
other wrappers -> they looked ok.
Diffstat (limited to 'src/libtrace')
-rw-r--r-- | src/libtrace/libtrace.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libtrace/libtrace.c b/src/libtrace/libtrace.c index a3d1571f7..9f2622c00 100644 --- a/src/libtrace/libtrace.c +++ b/src/libtrace/libtrace.c | |||
@@ -423,11 +423,11 @@ int stat(const char *pathname, struct stat *buf) { | |||
423 | typedef int (*orig_stat64_t)(const char *pathname, struct stat64 *buf); | 423 | typedef int (*orig_stat64_t)(const char *pathname, struct stat64 *buf); |
424 | static orig_stat64_t orig_stat64 = NULL; | 424 | static orig_stat64_t orig_stat64 = NULL; |
425 | int stat64(const char *pathname, struct stat64 *buf) { | 425 | int stat64(const char *pathname, struct stat64 *buf) { |
426 | if (!orig_stat) | 426 | if (!orig_stat64) |
427 | orig_stat64 = (orig_stat64_t)dlsym(RTLD_NEXT, "stat64"); | 427 | orig_stat64 = (orig_stat64_t)dlsym(RTLD_NEXT, "stat64"); |
428 | 428 | ||
429 | int rv = orig_stat64(pathname, buf); | 429 | int rv = orig_stat64(pathname, buf); |
430 | printf("%u:%s:stat %s:%d\n", pid(), name(), pathname, rv); | 430 | printf("%u:%s:stat64 %s:%d\n", pid(), name(), pathname, rv); |
431 | return rv; | 431 | return rv; |
432 | } | 432 | } |
433 | #endif /* __GLIBC__ */ | 433 | #endif /* __GLIBC__ */ |