🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Andrew Thomas Sun, 09 Jul 1989 21:37
Indirection through NULL pointer in bash-1.02
#282
Author: Andrew Thomas
Date: Sun, 09 Jul 1989 21:37
38 lines
1548 bytes
Using a uVax II under Ultrix 2.0:

Bash 1.02 performs an indirection through a null pointer when given
the line:

Meta-TAB:	expand-line

in the .inputrc file.  In the following diff, funmap[i] == 0, but on a
vax, funmap[i]->name is not an error.  No error is reported unless the
value of funmap[i]->name is outside the process space.  The following
diff solved the problem for me, though it might not be the correct
solution:

*** 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);
--

Andrew Thomas
andrewt@watsnew.waterloo.edu	Systems Design Eng.	University of Waterloo
"If a million people do a stupid thing, it's still a stupid thing." - Opus
Indirection through NULL pointer in bash-1.02
#284
Author: Brian Fox
Date: Mon, 10 Jul 1989 02:21
37 lines
1479 bytes
   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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads