This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH] Fix crash on demangle style completion
- To: gdb-patches at sources dot redhat dot com
- Subject: [PATCH] Fix crash on demangle style completion
- From: Daniel Berlin <dan at cgsoftware dot com>
- Date: 16 Apr 2001 10:35:52 -0400
This is an obvious fix (Just try completing on the demangle style, and
look what happens), so i'm checking it in.
2001-04-16 Daniel Berlin <dan@cgsoftware.com>
* demangle.c (_initialize_demangler): Use xcalloc on the
demangling_style_names, and make it a null terminated array of
names, to avoid a crash.
Index: demangle.c
===================================================================
RCS file: /cvs/src/src/gdb/demangle.c,v
retrieving revision 1.7
diff -c -3 -p -w -B -b -r1.7 demangle.c
*** demangle.c 2001/03/06 08:21:06 1.7
--- demangle.c 2001/04/16 14:34:53
*************** _initialize_demangler (void)
*** 186,192 ****
libiberty_demanglers[ndems].demangling_style != unknown_demangling;
ndems++)
;
! demangling_style_names = xmalloc (ndems * sizeof (char *));
for (i = 0;
libiberty_demanglers[i].demangling_style != unknown_demangling;
i++)
--- 186,192 ----
libiberty_demanglers[ndems].demangling_style != unknown_demangling;
ndems++)
;
! demangling_style_names = xcalloc (ndems + 1, sizeof (char *));
for (i = 0;
libiberty_demanglers[i].demangling_style != unknown_demangling;
i++)
--
I have two very rare photographs. One is a picture of Houdini
locking his keys in his car. The other is a rare photograph of
Norman Rockwell beating up a child.