diff --git a/ChangeLog b/ChangeLog index 45f6c04..b42a4d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ + * Really add ASCII null at command string in add_proc() of pstree.c + Changes in 22.16 ================ * Use strncpy for COMM_LEN and make it 18 characters to cover brackets diff --git a/src/pstree.c b/src/pstree.c index 80cfcec..a6c8f6e 100644 --- a/src/pstree.c +++ b/src/pstree.c @@ -265,7 +265,7 @@ static PROC *new_proc(const char *comm, pid_t pid, uid_t uid) exit(1); } strncpy(new->comm, comm, COMM_LEN+2); - new->comm[COMM_LEN+1]='\0'; /* make sure nul terminated*/ + new->comm[COMM_LEN+1] = '\0'; /* make sure nul terminated*/ new->pid = pid; new->uid = uid; new->flags = 0; @@ -354,7 +354,7 @@ add_proc(const char *comm, pid_t pid, pid_t ppid, uid_t uid, #endif /*WITH_SELINUX */ else { strncpy(this->comm, comm, COMM_LEN+2); - this->comm[COMM_LEN+1]; + this->comm[COMM_LEN+1] = '\0'; this->uid = uid; } if (args)