diff options
author | jmallett <jmallett@FreeBSD.org> | 2002-05-05 19:04:58 +0000 |
---|---|---|
committer | jmallett <jmallett@FreeBSD.org> | 2002-05-05 19:04:58 +0000 |
commit | 285791a69638a8c6cc6a9aa0bb65cf3441e78928 (patch) | |
tree | 21006cd681613d12ba5e555a6f05a571f6cec12b /usr.bin/make/str.c | |
parent | 62cedbf5fcf1db5d9c9b44842e4d98a9e8929b2b (diff) | |
download | FreeBSD-src-285791a69638a8c6cc6a9aa0bb65cf3441e78928.zip FreeBSD-src-285791a69638a8c6cc6a9aa0bb65cf3441e78928.tar.gz |
Fix make(1) behaviour regarding SysV-style substitution when given a nil
left-hand-side.
PR: bin/5297
Submitted by: "Matthew Emmerton" <matt@gsicomp.on.ca>
MFC after: 1 week
Diffstat (limited to 'usr.bin/make/str.c')
-rw-r--r-- | usr.bin/make/str.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/usr.bin/make/str.c b/usr.bin/make/str.c index 4889ec9..097e312 100644 --- a/usr.bin/make/str.c +++ b/usr.bin/make/str.c @@ -417,6 +417,12 @@ Str_SYSVMatch(word, pattern, len) char *w = word; char *m; + if (*w == '\0') { + /* Zero-length word cannot be matched against */ + *len = 0; + return NULL; + } + if (*p == '\0') { /* Null pattern is the whole string */ *len = strlen(w); |