aboutsummaryrefslogtreecommitdiff
path: root/gdb/ctf.c
diff options
context:
space:
mode:
authorYao Qi <yao@codesourcery.com>2014-04-18 19:22:23 +0800
committerYao Qi <yao@codesourcery.com>2014-04-19 10:36:08 +0800
commitdac3e7103f2822b42ecbb58e40f70f7ccb802d42 (patch)
tree71e4f34d0ce96af08b75606abb80abba4d3f6dfa /gdb/ctf.c
parent2bca57bacc88e4d81fd92c72f1d4eb42c1372ac8 (diff)
downloadgdb-dac3e7103f2822b42ecbb58e40f70f7ccb802d42.zip
gdb-dac3e7103f2822b42ecbb58e40f70f7ccb802d42.tar.gz
gdb-dac3e7103f2822b42ecbb58e40f70f7ccb802d42.tar.bz2
Add null pointer check in ctf_xfer_partial
I find a gdb crash when gdb reads ctf trace. The crash is caused by passing NULL to strcmp. This patch is to add null pointer check, as what we did somewhere else in ctf.c. gdb: 2014-04-19 Yao Qi <yao@codesourcery.com> * ctf.c (ctf_xfer_partial): Check 'name' is NULL before strcmp.
Diffstat (limited to 'gdb/ctf.c')
-rw-r--r--gdb/ctf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/ctf.c b/gdb/ctf.c
index ebd40d6..b684a36 100644
--- a/gdb/ctf.c
+++ b/gdb/ctf.c
@@ -1399,7 +1399,7 @@ ctf_xfer_partial (struct target_ops *ops, enum target_object object,
= bt_ctf_iter_read_event (ctf_iter);
const char *name = bt_ctf_event_name (event);
- if (strcmp (name, "frame") == 0)
+ if (name == NULL || strcmp (name, "frame") == 0)
break;
else if (strcmp (name, "memory") != 0)
{