diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-07-10 12:02:34 +0200 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-07-10 22:11:28 +0200 |
commit | 7f554464a16723e305186f5df0889406f808363f (patch) | |
tree | a7765314560bc4430114470a432da8e015922347 /sal | |
parent | 942c21a003ffa2644d89c2262b55b8320f8d51aa (diff) |
coverity#982762 Dereference NULL
Change-Id: I9da66fe9cf279231d6024f23fbb273797b289ba7
Diffstat (limited to 'sal')
-rw-r--r-- | sal/osl/unx/process.cxx | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sal/osl/unx/process.cxx b/sal/osl/unx/process.cxx index 0a0ba0240fb1..eb2458643c6e 100644 --- a/sal/osl/unx/process.cxx +++ b/sal/osl/unx/process.cxx @@ -919,11 +919,14 @@ bool osl_getProcStat(pid_t pid, struct osl_procStat* procstat) return false; tmp = strrchr(prstatbuf, ')'); - *tmp = '\0'; - memset(procstat->command, 0, sizeof(procstat->command)); + if(tmp) + { + *tmp = '\0'; - sscanf(prstatbuf, "%d (%15c", &procstat->pid, procstat->command); - sscanf(tmp + 2, + memset(procstat->command, 0, sizeof(procstat->command)); + + sscanf(prstatbuf, "%d (%15c", &procstat->pid, procstat->command); + sscanf(tmp + 2, "%c" "%i %i %i %i %i" "%lu %lu %lu %lu %lu" @@ -943,6 +946,11 @@ bool osl_getProcStat(pid_t pid, struct osl_procStat* procstat) procstat->signal, procstat->blocked, procstat->sigignore, procstat->sigcatch, &procstat->wchan, &procstat->nswap, &procstat->cnswap ); + } + else + { + bRet = false; + } } return bRet; } |