This is in generic code in 6.1 (at least down to MArker ##### it is,
so ive made it a .no_customise file so I know I dont have tpo patch any more,
& when all my systems are on 6 & not 4 & 5 I can dump this.

I dont recognise this so I guess someone else wrote this, not me, jhs@

*** 5.4-RELEASE/src/usr.bin/make/make.1	
--- new/src/usr.bin/make/make.1	
Index: suff.c
===================================================================
RCS file: /local/cvs/freebsd/src/usr.bin/make/suff.c,v
retrieving revision 1.29
diff -u -r1.29 suff.c
--- 5.4-RELEASE/src/usr.bin/make/suff.c	12 Apr 2004 20:05:11 -0000	1.29
+++ new/src/usr.bin/make/suff.c	1 Jun 2005 13:46:11 -0000
@@ -92,6 +92,7 @@
  *	    	  	    	if the target had no implicit sources.
  */
 
+#include	  <assert.h>
 #include    	  <stdio.h>
 #include	  "make.h"
 #include	  "hash.h"
@@ -205,8 +206,7 @@
 /*-
  *-----------------------------------------------------------------------
  * SuffSuffIsSuffix  --
- *	See if suff is a suffix of str. Str should point to THE END of the
- *	string to check. (THE END == the null byte)
+ *	See if suff is a suffix of str.
  *
  * Results:
  *	NULL if it ain't, pointer to character in str before suffix if
@@ -221,13 +221,16 @@
 {
     char	   *p1;	    	/* Pointer into suffix name */
     char	   *p2;	    	/* Pointer into string being examined */
+    size_t	   len;
 
+    len = strlen(str);
     p1 = s->name + s->nameLen;
-    p2 = str;
+    p2 = str + len;
 
-    while (p1 >= s->name && *p1 == *p2) {
+    while (p1 >= s->name && len > 0 && *p1 == *p2) {
 	p1--;
 	p2--;
+	len--;
     }
 
     return (p1 == s->name - 1 ? p2 : NULL);
@@ -253,6 +256,7 @@
     return(!SuffSuffIsSuffix((Suff *) s, (char *) str));
 }
 
+
 /*-
  *-----------------------------------------------------------------------
  * SuffSuffHasNameP --
@@ -720,7 +724,7 @@
     /*
      * Not from, maybe to?
      */
-    cp = SuffSuffIsSuffix(s, transform->name + strlen(transform->name));
+    cp = SuffSuffIsSuffix(s, transform->name);
     if (cp != (char *)NULL) {
 	/*
 	 * Null-terminate the source suffix in order to find it.
#####
##### At least above here I jhs@ can see is now in generic 6.1-RELEASE.
#####
@@ -1407,8 +1411,7 @@
 	 *   suffix, use its path.
 	 * Else use the default system search path.
 	 */
-	cp = cgn->name + strlen(cgn->name);
-	ln = Lst_Find(sufflist, (void *)cp, SuffSuffIsSuffixP);
+	ln = Lst_Find(sufflist, (void *)cgn->name, SuffSuffIsSuffixP);
 
 	DEBUGF(SUFF, ("Wildcard expanding \"%s\"...", cgn->name));
 
@@ -1670,7 +1673,7 @@
 	/*
 	 * Use first matching suffix...
 	 */
-	ln = Lst_Find(ms->parents, eoarch, SuffSuffIsSuffixP);
+	ln = Lst_Find(ms->parents, gn->name, SuffSuffIsSuffixP);
 
 	if (ln != NULL) {
 	    /*
@@ -1768,7 +1771,7 @@
 	/*
 	 * Look for next possible suffix...
 	 */
-	ln = Lst_FindFrom(sufflist, ln, eoname, SuffSuffIsSuffixP);
+	ln = Lst_FindFrom(sufflist, ln, gn->name, SuffSuffIsSuffixP);
 
 	if (ln != NULL) {
 	    int	    prefLen;	    /* Length of the prefix */
@@ -1793,6 +1796,7 @@
 	     * the length of the suffix from the end of the name.
 	     */
 	    prefLen = (eoname - target->suff->nameLen) - sopref;
+	    assert(prefLen >= 0);
 	    target->pref = emalloc(prefLen + 1);
 	    memcpy(target->pref, sopref, prefLen);
 	    target->pref[prefLen] = '\0';
