]> cvs.zerfleddert.de Git - proxmark3-svn/blobdiff - client/whereami.c
Fix memory bounds error
[proxmark3-svn] / client / whereami.c
index 021ad8748c9b0da422c397dbbfc901930126a1f3..6e5e85f39c52e1e5bc4d8019f6c8519a2862e717 100644 (file)
 extern "C" {
 #endif
 
+#if defined(__linux__)
+// make realpath() available:
+#define _DEFAULT_SOURCE
+#endif
+
 #if !defined(WAI_MALLOC) || !defined(WAI_FREE) || !defined(WAI_REALLOC)
 #include <stdlib.h>
 #endif
@@ -256,7 +261,7 @@ int WAI_PREFIX(getModulePath)(char* out, int capacity, int* dirname_length)
       if (!fgets(buffer, sizeof(buffer), maps))
         break;
 
-      if (sscanf(buffer, "%" PRIx64 "-%" PRIx64 " %s %" PRIx64 " %x:%x %u %s\n", &low, &high, perms, &offset, &major, &minor, &inode, path) == 8)
+      if (sscanf(buffer, "%" SCNx64 "-%" SCNx64 " %s %" SCNx64 " %x:%x %u %s\n", &low, &high, perms, &offset, &major, &minor, &inode, path) == 8)
       {
         uint64_t addr = (uint64_t)(uintptr_t)WAI_RETURN_ADDRESS();
         if (low <= addr && addr <= high)
Impressum, Datenschutz