Kaydet (Commit) 7f554464 authored tarafından Norbert Thiebaud's avatar Norbert Thiebaud

coverity#982762 Dereference NULL

Change-Id: I9da66fe9cf279231d6024f23fbb273797b289ba7
üst 942c21a0
...@@ -919,11 +919,14 @@ bool osl_getProcStat(pid_t pid, struct osl_procStat* procstat) ...@@ -919,11 +919,14 @@ bool osl_getProcStat(pid_t pid, struct osl_procStat* procstat)
return false; return false;
tmp = strrchr(prstatbuf, ')'); tmp = strrchr(prstatbuf, ')');
*tmp = '\0'; if(tmp)
memset(procstat->command, 0, sizeof(procstat->command)); {
*tmp = '\0';
sscanf(prstatbuf, "%d (%15c", &procstat->pid, procstat->command); memset(procstat->command, 0, sizeof(procstat->command));
sscanf(tmp + 2,
sscanf(prstatbuf, "%d (%15c", &procstat->pid, procstat->command);
sscanf(tmp + 2,
"%c" "%c"
"%i %i %i %i %i" "%i %i %i %i %i"
"%lu %lu %lu %lu %lu" "%lu %lu %lu %lu %lu"
...@@ -943,6 +946,11 @@ bool osl_getProcStat(pid_t pid, struct osl_procStat* procstat) ...@@ -943,6 +946,11 @@ bool osl_getProcStat(pid_t pid, struct osl_procStat* procstat)
procstat->signal, procstat->blocked, procstat->sigignore, procstat->sigcatch, procstat->signal, procstat->blocked, procstat->sigignore, procstat->sigcatch,
&procstat->wchan, &procstat->nswap, &procstat->cnswap &procstat->wchan, &procstat->nswap, &procstat->cnswap
); );
}
else
{
bRet = false;
}
} }
return bRet; return bRet;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment