summaryrefslogtreecommitdiff
path: root/libpagemap/pm_process.c
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2013-05-15 18:31:05 -0700
committerColin Cross <ccross@android.com>2013-06-24 14:55:16 -0700
commit5d461218f8c38dadf831ccc52ac6e5153687cf17 (patch)
tree565538c89f57b4460d5df64c8103a86ce5e2e9fb /libpagemap/pm_process.c
parent69294b5bf79dd0f0909ed8831fbac0f3ab5bf1e5 (diff)
downloadextras-5d461218f8c38dadf831ccc52ac6e5153687cf17.tar.gz
libpagemap: fix reusing previous name for mappings with no name
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
Diffstat (limited to 'libpagemap/pm_process.c')
-rw-r--r--libpagemap/pm_process.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/libpagemap/pm_process.c b/libpagemap/pm_process.c
index dddff011..c9aa8cab 100644
--- a/libpagemap/pm_process.c
+++ b/libpagemap/pm_process.c
@@ -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);