From: Daniel Berlin Date: Mon, 16 Apr 2001 14:36:16 +0000 (+0000) Subject: 2001-04-16 Daniel Berlin X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9e0c176c3ba84547dc6c5dbe3edd0796fdb8a44f;p=binutils-gdb.git 2001-04-16 Daniel Berlin * demangle.c (_initialize_demangler): Use xcalloc on the demangling_style_names, and make it a null terminated array of names, to avoid a crash. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 807aa0b7f8f..db36920d705 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2001-04-16 Daniel Berlin + + * demangle.c (_initialize_demangler): Use xcalloc on the + demangling_style_names, and make it a null terminated array of + names, to avoid a crash. + 2001-04-16 Mark Kettenis * i386-tdep.c (i386_frame_chain): New function. diff --git a/gdb/demangle.c b/gdb/demangle.c index 4b5bc9becbd..0104d8f3f6e 100644 --- a/gdb/demangle.c +++ b/gdb/demangle.c @@ -186,7 +186,7 @@ _initialize_demangler (void) libiberty_demanglers[ndems].demangling_style != unknown_demangling; ndems++) ; - demangling_style_names = xmalloc (ndems * sizeof (char *)); + demangling_style_names = xcalloc (ndems + 1, sizeof (char *)); for (i = 0; libiberty_demanglers[i].demangling_style != unknown_demangling; i++)