OSDN Git Service

Fix incorrect size of array.
authorChristopher Ferris <cferris@google.com>
Sat, 20 Feb 2016 02:13:29 +0000 (18:13 -0800)
committerChristopher Ferris <cferris@google.com>
Sat, 20 Feb 2016 02:13:29 +0000 (18:13 -0800)
When using sscanf and "%4s", the array passed in must include space for
a nul terminator.

Bug: 26739265
Change-Id: I0140a6100ca370666ae61689087ba41b4914789d

libc/malloc_debug/Android.mk
libc/malloc_debug/MapData.cpp

index fb36643..3576611 100644 (file)
@@ -37,7 +37,6 @@ LOCAL_NATIVE_COVERAGE := false
 LOCAL_CFLAGS := \
     -Wall \
     -Werror \
-    -fno-stack-protector \
     -Wno-error=format-zero-length \
 
 include $(BUILD_STATIC_LIBRARY)
index 8e9c806..d57017e 100644 (file)
@@ -44,7 +44,7 @@ static MapEntry* parse_line(char* line) {
   uintptr_t start;
   uintptr_t end;
   uintptr_t offset;
-  char permissions[4];
+  char permissions[5];
   int name_pos;
   if (sscanf(line, "%" PRIxPTR "-%" PRIxPTR " %4s %" PRIxPTR " %*x:%*x %*d %n", &start,
              &end, permissions, &offset, &name_pos) < 2) {