aboutsummaryrefslogtreecommitdiff
path: root/libctf
diff options
context:
space:
mode:
Diffstat (limited to 'libctf')
-rw-r--r--libctf/ChangeLog5
-rw-r--r--libctf/ctf-types.c3
2 files changed, 7 insertions, 1 deletions
diff --git a/libctf/ChangeLog b/libctf/ChangeLog
index 1069553..8f41ece 100644
--- a/libctf/ChangeLog
+++ b/libctf/ChangeLog
@@ -1,3 +1,8 @@
+2019-08-08 Nick Alcock <nick.alcock@oracle.com>
+
+ * ctf-types.c (ctf_type_name): Don't strlen a potentially-
+ null pointer.
+
2019-08-07 Nick Alcock <nick.alcock@oracle.com>
* ctf-impl.h (ctf_file_t) <ctf_add_processing>: New.
diff --git a/libctf/ctf-types.c b/libctf/ctf-types.c
index 6e67762..ec221d7 100644
--- a/libctf/ctf-types.c
+++ b/libctf/ctf-types.c
@@ -438,11 +438,12 @@ ssize_t
ctf_type_lname (ctf_file_t *fp, ctf_id_t type, char *buf, size_t len)
{
char *str = ctf_type_aname (fp, type);
- size_t slen = strlen (str);
+ size_t slen;
if (str == NULL)
return CTF_ERR; /* errno is set for us */
+ slen = strlen (str);
snprintf (buf, len, "%s", str);
free (str);