[comp.mail.mh] slocal bug fix

dce@mips.COM (David Elliott) (08/25/88)

This subject has been discussed before, and I had a fix for the bug,
but was unable to find it because I didn't keep around a copy of
the old MH sources.

Anyway, the slocal program will dump core on machines that forbid null
pointer dereferences, and the problem is that sbr/strindex.c may be
given null pointers.  This happens on versions 6.3, 6.5, and 6.6.

The following, which I have used for 2 years, fixes this:

*** strindex.c.orig	Thu Aug 25 07:47:36 1988
--- strindex.c	Wed Aug 24 15:48:14 1988
***************
*** 7,12 ****
--- 7,16 ----
  {
      register char  *p;
  
+     if (p1 == 0 || p2 == 0) {
+ 	return (-1);
+     }
+ 
      for (p = p2; *p; p++)
  	if (uprf (p, p1))
  	    return (p - p2);