From ade4ded301002cd5bd4ff740b132d8dc14ffd0b2 Mon Sep 17 00:00:00 2001 From: "David E. O'Brien" Date: Sat, 13 Apr 2002 19:36:47 +0000 Subject: Revision 1.17 seems to break a subsequent buildworld (i.e. with the new make installed) in gnu/usr.bin/groff/src/preproc/eqn (which, being a build tool itself, is built with the original make during buildworld). The problem seems to be that in str_concat(), the string is not terminated when the length of the second string is 0. This apparently can happen during null suffix rule processing. Submitted by: tmm --- usr.bin/make/str.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'usr.bin/make') diff --git a/usr.bin/make/str.c b/usr.bin/make/str.c index 87557a8d19c0..03ff7a4a73a2 100644 --- a/usr.bin/make/str.c +++ b/usr.bin/make/str.c @@ -112,9 +112,12 @@ str_concat(s1, s2, flags) result[len1++] = '/'; } - /* copy second string plus EOS into place */ + /* copy second string into place */ if (len2) - memcpy(result + len1, s2, len2 + 1); + memcpy(result + len1, s2, len2); + + /* Terminate. */ + result[len1 + len2] = '\0'; /* free original strings */ if (flags & STR_DOFREE) { -- cgit v1.3