← Commit list

393ad1a83

Glenn L McGrath
Glenn L McGrath
2002-11-25
FAILED Duration: 7s

Subject

Handle name entries that have a \0 in them, last_patch_65 from Vladimir N. Oleynik

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

libbb/procps.c+11 -4
@@ -110,10 +110,17 @@ extern procps_status_t * procps_scan(int save_user_arg0)
if(save_user_arg0) {
if((fp = fopen(status, "r")) == NULL)
continue;
- if(fgets(buf, sizeof(buf), fp) != NULL) {
- name = strchr(buf, '\n');
- if(name != NULL)
- *name = 0;
+ if((n=fread(buf, 1, sizeof(buf)-1, fp)) > 0) {
+ if(buf[n-1]=='\n')
+ buf[--n] = 0;
+ name = buf;
+ while(n) {
+ if(*name < ' ')
+ *name = ' ';
+ name++;
+ n--;
+ }
+ *name = 0;
if(buf[0])
curstatus.cmd = strdup(buf);
/* if NULL it work true also */