Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Aleksandar Ristovski <ARistovski@qnx.com>
To: gdb-patches@sourceware.org
Subject: [patch] Avoid null ptr dereference in maint cplus first_component
Date: Wed, 19 Mar 2008 19:13:00 -0000	[thread overview]
Message-ID: <47E165D3.7090203@qnx.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 306 bytes --]

Hello,

A trivial patch to avoid segemtation fault when no argument is supplied to 
'maint cplus first_component' command.

Thanks,

---
Aleksandar Ristovski
QNX Software Systems


2008-03-19  Aleksandar Ristovski <aristovski@qnx.com>

	* cp-support.c (first_component_command): Return if no arguments.




[-- Attachment #2: cp-support.c.diff --]
[-- Type: text/plain, Size: 686 bytes --]

Index: gdb/cp-support.c
===================================================================
RCS file: /cvs/src/src/gdb/cp-support.c,v
retrieving revision 1.26
diff -u -p -r1.26 cp-support.c
--- gdb/cp-support.c	1 Jan 2008 22:53:09 -0000	1.26
+++ gdb/cp-support.c	19 Mar 2008 19:07:54 -0000
@@ -892,8 +892,14 @@ maint_cplus_command (char *arg, int from
 static void
 first_component_command (char *arg, int from_tty)
 {
-  int len = cp_find_first_component (arg);
-  char *prefix = alloca (len + 1);
+  int len;  
+  char *prefix; 
+
+  if (!arg)
+    return;
+
+  len = cp_find_first_component (arg);
+  prefix = alloca (len + 1);
 
   memcpy (prefix, arg, len);
   prefix[len] = '\0';

             reply	other threads:[~2008-03-19 19:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-19 19:13 Aleksandar Ristovski [this message]
2008-03-21 15:34 ` Daniel Jacobowitz

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=47E165D3.7090203@qnx.com \
    --to=aristovski@qnx.com \
    --cc=gdb-patches@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