OSDN Git Service

libpagemap: fix reusing previous name for mappings with no name
authorColin Cross <ccross@android.com>
Thu, 16 May 2013 01:31:05 +0000 (18:31 -0700)
committerColin Cross <ccross@android.com>
Mon, 24 Jun 2013 21:55:16 +0000 (14:55 -0700)
Mappings that are not from a file do not have a name.  The sscanf
will read all of the fields up to the name, and then leave name
untouched.  This causes the previous name to be reused.  Reset
name to an empty string before each call to sscanf.

Change-Id: Ib146732983eb074d0d4773be094efa0b672f5ed2

libpagemap/pm_process.c

index dddff01..c9aa8ca 100644 (file)
@@ -261,6 +261,7 @@ static int read_maps(pm_process_t *proc) {
 
         map->proc = proc;
 
+        name[0] = '\0';
         sscanf(line, "%lx-%lx %s %lx %*s %*d %" S(MAX_LINE) "s",
                &map->start, &map->end, perms, &map->offset, name);