From: Qualys Security Advisory Date: Thu, 1 Jan 1970 00:00:00 +0000 (+0000) Subject: pmap: Harden one_proc(). X-Git-Tag: v3.3.15~50 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c9241d85ac7080162ed59dacfd2e7f3edad51f2d;p=procps-ng pmap: Harden one_proc(). Replace sprintf() with snprintf(). --- diff --git a/pmap.c b/pmap.c index 9bc9c4c0..48a4f199 100644 --- a/pmap.c +++ b/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; }