From a733a5092b404276af646b522430466df19a1612 Mon Sep 17 00:00:00 2001 From: Thomas Jarosch Date: Sat, 30 Jul 2016 23:40:55 +0200 Subject: 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. --- src/libtrace/libtrace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/libtrace') 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) { typedef int (*orig_stat64_t)(const char *pathname, struct stat64 *buf); static orig_stat64_t orig_stat64 = NULL; int stat64(const char *pathname, struct stat64 *buf) { - if (!orig_stat) + if (!orig_stat64) orig_stat64 = (orig_stat64_t)dlsym(RTLD_NEXT, "stat64"); int rv = orig_stat64(pathname, buf); - printf("%u:%s:stat %s:%d\n", pid(), name(), pathname, rv); + printf("%u:%s:stat64 %s:%d\n", pid(), name(), pathname, rv); return rv; } #endif /* __GLIBC__ */ -- cgit v1.2.3-54-g00ecf