summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCristian Rodríguez <crrodriguez@opensuse.org>2013-05-22 18:22:37 -0400
committerCristian Rodríguez <crrodriguez@opensuse.org>2013-05-22 18:22:37 -0400
commit5a39544b215c99e93ba435aa4a671b0192329c08 (patch)
tree521c5e0956aee59d382e7e01bf8ee92c2493ef00
parent39c6de4c8788fae91e008cc686db1d1e65b8bbc5 (diff)
downloadprocps-ng-5a39544b215c99e93ba435aa4a671b0192329c08.tar.gz
Fix off-by-one in pmap
When procps is built with gcc 4.8 address sanitizer static int one_proc(proc_t * p).. .. char smap_key[20]; ... (sscanf(mapbuf, "%20[^:]: %llu", smap_key.. rightfully results in an overflow and the program aborts.
-rw-r--r--pmap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pmap.c b/pmap.c
index 95f365f..8f111a0 100644
--- a/pmap.c
+++ b/pmap.c
@@ -591,7 +591,7 @@ static int one_proc(proc_t * p)
unsigned long long file_offset, inode;
unsigned dev_major, dev_minor;
unsigned long long smap_value;
- char smap_key[20];
+ char smap_key[21];
/* hex values are lower case or numeric, keys are upper */
if (mapbuf[0] >= 'A' && mapbuf[0] <= 'Z') {