Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!AUREL.CALTECH.EDU!bfox From: bfox@AUREL.CALTECH.EDU (Brian Fox) Newsgroups: gnu.bash.bug Subject: Indirection through NULL pointer in bash-1.02 Message-ID: <8907100221.AA26973@aurel.caltech.edu> Date: 10 Jul 89 02:21:40 GMT References: Sender: daemon@tut.cis.ohio-state.edu Reply-To: bfox@aurel.caltech.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 37 Date: 9 Jul 89 21:37:33 GMT From: utgpu!watmath!watcgl!andrewt@jarvis.csri.toronto.edu (Andrew Thomas) Bash 1.02 performs an indirection through a null pointer ... *** readline.c.orig Thu Jul 6 13:36:14 1989 --- readline.c Sun Jul 9 17:12:00 1989 *************** *** 3797,3803 **** { register int i; ! for (i = 0; funmap[i]->name; i++) if (stricmp (funmap[i]->name, string) == 0) return (funmap[i]->function); return ((Function *)NULL); --- 3797,3803 ---- { register int i; ! for (i = 0; funmap[i] && funmap[i]->name; i++) if (stricmp (funmap[i]->name, string) == 0) return (funmap[i]->function); return ((Function *)NULL); -- Thanks, Andrew. This happened in 1.02 because I made funmaps be dynamically allocated, which changed the test conditions. You patch is correct, but has too much code; the solution is for (i = 0; funmap[i]; i++) Brian