proc/readproc.c: Harden get_proc_stats().
Replace sprintf() with snprintf().
This commit is contained in:
parent
1b8ec51013
commit
19849a45e0
@ -1635,7 +1635,7 @@ proc_t * get_proc_stats(pid_t pid, proc_t *p) {
|
|||||||
static char path[32];
|
static char path[32];
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
|
|
||||||
sprintf(path, "/proc/%d", pid);
|
snprintf(path, sizeof path, "/proc/%d", pid);
|
||||||
if (stat(path, &statbuf)) {
|
if (stat(path, &statbuf)) {
|
||||||
perror("stat");
|
perror("stat");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user