* [patch] Avoid null ptr dereference in maint cplus first_component
@ 2008-03-19 19:13 Aleksandar Ristovski
2008-03-21 15:34 ` Daniel Jacobowitz
0 siblings, 1 reply; 2+ messages in thread
From: Aleksandar Ristovski @ 2008-03-19 19:13 UTC (permalink / raw)
To: gdb-patches
[-- 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';
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch] Avoid null ptr dereference in maint cplus first_component
2008-03-19 19:13 [patch] Avoid null ptr dereference in maint cplus first_component Aleksandar Ristovski
@ 2008-03-21 15:34 ` Daniel Jacobowitz
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Jacobowitz @ 2008-03-21 15:34 UTC (permalink / raw)
To: Aleksandar Ristovski; +Cc: gdb-patches
On Wed, Mar 19, 2008 at 03:13:23PM -0400, Aleksandar Ristovski wrote:
> 2008-03-19 Aleksandar Ristovski <aristovski@qnx.com>
>
> * cp-support.c (first_component_command): Return if no arguments.
OK, thanks. Did I already ask you about write access?
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-03-21 15:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-19 19:13 [patch] Avoid null ptr dereference in maint cplus first_component Aleksandar Ristovski
2008-03-21 15:34 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox