Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [commit] dwarf2read.c (typename_concat): avoid segv
@ 2008-10-24 18:26 Doug Evans
  2008-10-24 18:43 ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Doug Evans @ 2008-10-24 18:26 UTC (permalink / raw)
  To: gdb-patches

Hi. I checked in the following as obvious.
Running a large app with many shared libs under gdb -r caused gdb to segv.

2008-10-24  Doug Evans  <dje@google.com>

	* dwarf2read.c (typename_concat): Don't segv if prefix or suffix
	is NULL.  Simplify obs == NULL case.

Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.289
diff -u -p -r1.289 dwarf2read.c
--- dwarf2read.c	10 Oct 2008 16:15:42 -0000	1.289
+++ dwarf2read.c	24 Oct 2008 18:12:01 -0000
@@ -8081,19 +8081,17 @@ typename_concat (struct obstack *obs, co
   else
     sep = "::";
 
+  if (prefix == NULL)
+    prefix = "";
+  if (suffix == NULL)
+    suffix = "";
+
   if (obs == NULL)
     {
       char *retval = xmalloc (strlen (prefix) + MAX_SEP_LEN + strlen (suffix) + 1);
-      retval[0] = '\0';
-      
-      if (prefix)
-	{
-	  strcpy (retval, prefix);
-	  strcat (retval, sep);
-	}
-      if (suffix)
-	strcat (retval, suffix);
-      
+      strcpy (retval, prefix);
+      strcat (retval, sep);
+      strcat (retval, suffix);
       return retval;
     }
   else


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-10-24 19:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-24 18:26 [commit] dwarf2read.c (typename_concat): avoid segv Doug Evans
2008-10-24 18:43 ` Daniel Jacobowitz
2008-10-24 18:48   ` Daniel Jacobowitz
2008-10-24 18:57     ` Doug Evans
2008-10-24 19:01       ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox