mirror of
https://github.com/sheumann/hush.git
synced 2024-12-28 07:30:23 +00:00
Handle name entries that have a \0 in them, last_patch_65 from Vladimir N. Oleynik
This commit is contained in:
parent
bb2e9d47f3
commit
393ad1a834
@ -110,10 +110,17 @@ extern procps_status_t * procps_scan(int save_user_arg0)
|
|||||||
if(save_user_arg0) {
|
if(save_user_arg0) {
|
||||||
if((fp = fopen(status, "r")) == NULL)
|
if((fp = fopen(status, "r")) == NULL)
|
||||||
continue;
|
continue;
|
||||||
if(fgets(buf, sizeof(buf), fp) != NULL) {
|
if((n=fread(buf, 1, sizeof(buf)-1, fp)) > 0) {
|
||||||
name = strchr(buf, '\n');
|
if(buf[n-1]=='\n')
|
||||||
if(name != NULL)
|
buf[--n] = 0;
|
||||||
*name = 0;
|
name = buf;
|
||||||
|
while(n) {
|
||||||
|
if(*name < ' ')
|
||||||
|
*name = ' ';
|
||||||
|
name++;
|
||||||
|
n--;
|
||||||
|
}
|
||||||
|
*name = 0;
|
||||||
if(buf[0])
|
if(buf[0])
|
||||||
curstatus.cmd = strdup(buf);
|
curstatus.cmd = strdup(buf);
|
||||||
/* if NULL it work true also */
|
/* if NULL it work true also */
|
||||||
|
Loading…
Reference in New Issue
Block a user