public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb] libctf: allow ctf_type_lname of a null pointer.
Date: Wed, 09 Oct 2019 18:25:00 -0000	[thread overview]
Message-ID: <1a6ab13e712348c59c2757457b9f913a333f3c92@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT 1a6ab13e712348c59c2757457b9f913a333f3c92 ***

commit 1a6ab13e712348c59c2757457b9f913a333f3c92
Author:     Nick Alcock <nick.alcock@oracle.com>
AuthorDate: Thu Aug 8 16:53:48 2019 +0100
Commit:     Nick Alcock <nick.alcock@oracle.com>
CommitDate: Thu Oct 3 17:04:56 2019 +0100

    libctf: allow ctf_type_lname of a null pointer.
    
    The code was meant to handle this, but accidentally dereferenced the
    null pointer before checking it for nullity.
    
    v5: fix tabdamage.
    
    libctf/
            * ctf-types.c (ctf_type_name): Don't strlen a potentially-
            null pointer.

diff --git a/libctf/ChangeLog b/libctf/ChangeLog
index 106955385d..8f41ece32b 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 6e67762234..ec221d7349 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);
 


             reply	other threads:[~2019-10-09 18:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-09 18:25 gdb-buildbot [this message]
2019-10-09 18:25 ` Failures on Ubuntu-Aarch64-m64, branch master gdb-buildbot
2019-10-09 20:32 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, " gdb-buildbot
2019-10-12 13:50 ` Failures on Fedora-i686, " gdb-buildbot
2019-10-12 14:09 ` Failures on Fedora-x86_64-m32, " gdb-buildbot
2019-10-12 14:36 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2019-10-12 15:03 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot
2019-10-12 15:32 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot
2019-10-12 15:48 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot
2019-10-12 16:21 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1a6ab13e712348c59c2757457b9f913a333f3c92@gdb-build \
    --to=gdb-buildbot@sergiodj.net \
    --cc=gdb-testers@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).