From 5a39544b215c99e93ba435aa4a671b0192329c08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= Date: Wed, 22 May 2013 18:22:37 -0400 Subject: [PATCH] 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. --- pmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmap.c b/pmap.c index 95f365f9..8f111a03 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') {