pmap: Harden one_proc().
Replace sprintf() with snprintf().
This commit is contained in:
parent
737fbff0e6
commit
c9241d85ac
4
pmap.c
4
pmap.c
@ -544,11 +544,11 @@ static int one_proc(proc_t * p)
|
||||
printf("%u: %s\n", p->tgid, cmdbuf);
|
||||
|
||||
if (x_option || X_option || c_option) {
|
||||
sprintf(buf, "/proc/%u/smaps", p->tgid);
|
||||
snprintf(buf, sizeof buf, "/proc/%u/smaps", p->tgid);
|
||||
if ((fp = fopen(buf, "r")) == NULL)
|
||||
return 1;
|
||||
} else {
|
||||
sprintf(buf, "/proc/%u/maps", p->tgid);
|
||||
snprintf(buf, sizeof buf, "/proc/%u/maps", p->tgid);
|
||||
if ((fp = fopen(buf, "r")) == NULL)
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user