From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Berlin To: gdb-patches@sources.redhat.com Subject: [PATCH] Fix crash on demangle style completion Date: Mon, 16 Apr 2001 07:35:00 -0000 Message-id: X-SW-Source: 2001-04/msg00158.html 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 * 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.