mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-26 20:22:11 +01:00
gtestutils: Fix a potential NULL pointer dereference in g_test_log()
Although unlikely, apparently `message` may be `NULL` (the rest of the code checks for it), so the code to convert newlines to spaces should probably also check for `NULL`. Signed-off-by: Philip Withnall <pwithnall@endlessos.org> Coverity CID: #1504054
This commit is contained in:
parent
20c4fcb2a7
commit
2676ef03cc
@ -1214,13 +1214,16 @@ g_test_log (GTestLogType lbit,
|
||||
if (test_tap_log)
|
||||
{
|
||||
char *message = g_strdup (string1);
|
||||
char *line = message;
|
||||
|
||||
while ((line = strchr (line, '\n')))
|
||||
*(line++) = ' ';
|
||||
|
||||
if (message)
|
||||
message = g_strstrip (message);
|
||||
{
|
||||
char *line = message;
|
||||
|
||||
while ((line = strchr (line, '\n')))
|
||||
*(line++) = ' ';
|
||||
|
||||
message = g_strstrip (message);
|
||||
}
|
||||
|
||||
if (test_run_name && *test_run_name != '\0')
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user