mirror of https://github.com/xzeldon/htop.git
DiD: Avoid negative cmdlineBasenameOffset
This commit is contained in:
parent
12f5f06e88
commit
12208af777
|
@ -202,6 +202,9 @@ static bool findCommInCmdline(const char *comm, const char *cmdline, int cmdline
|
||||||
size_t tokenLen;
|
size_t tokenLen;
|
||||||
const size_t commLen = strlen(comm);
|
const size_t commLen = strlen(comm);
|
||||||
|
|
||||||
|
if (cmdlineBasenameOffset < 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
for (const char *token = cmdline + cmdlineBasenameOffset; *token; ) {
|
for (const char *token = cmdline + cmdlineBasenameOffset; *token; ) {
|
||||||
for (tokenBase = token; *token && *token != '\n'; ++token) {
|
for (tokenBase = token; *token && *token != '\n'; ++token) {
|
||||||
if (*token == '/') {
|
if (*token == '/') {
|
||||||
|
|
Loading…
Reference in New Issue