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.
This commit is contained in:
Cristian Rodríguez 2013-05-22 18:22:37 -04:00
parent 39c6de4c87
commit 5a39544b21

2
pmap.c
View File

@ -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') {