Commit c5bc3a6c authored by George Karagiannidis's avatar George Karagiannidis Committed by David Edmundson

Null pointer dereference at ksysguard

Summary:
Attempting to write to a NULL pointer, if the
```
strchr( confLog->name, ':' );
```
has returned null.
This can happen in case a config file doesn't have the ":" symbol.
The application crashes this way.

File: `ksysguardd/conf.c`

Test Plan:
{F6819376} Using this file, and running
`ksysguardd -d -i -p 1234 -f segfaultrigger.txt` a segmentation fault is generated:

```
root@pc:~# ksysguardd -d -i -p 1234 -f segtrig.txt
ksysguardd 4
(c) 1999, 2000, 2001, 2002 Chris Schlaeger <cs@kde.org>
(c) 2001 Tobias Koenig <tokoe@kde.org>
(c) 2006-2008 Greg Martyn <greg.martyn@gmail.com>
This program is part of the KDE Project and licensed under
the GNU GPL version 2. See http://www.kde.org for details.
Segmentation fault
```

Reviewers: davidedmundson

Reviewed By: davidedmundson

Subscribers: davidedmundson, apol, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D21147
parent 4c7137e8
......@@ -110,11 +110,18 @@ void parseConfigFile( const char *filename )
}
confLog->name = strdup( token );
tmp = strchr( confLog->name, ':' );
*tmp = '\0';
confLog->path = tmp;
confLog->path++;
push_ctnr( LogFileList, confLog );
if(tmp)
{
*tmp = '\0';
confLog->path = tmp;
confLog->path++;
push_ctnr( LogFileList, confLog );
}
else
{
print_error("Invalid config file");
exit(EXIT_FAILURE);
}
}
}
......
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