diff options
author | Ray Lai <ray@cvs.openbsd.org> | 2006-12-06 05:05:17 +0000 |
---|---|---|
committer | Ray Lai <ray@cvs.openbsd.org> | 2006-12-06 05:05:17 +0000 |
commit | 5757e9ac3ed9dd21f0db13c012c60ea7c9fa268f (patch) | |
tree | e3f7cf8dda9f59a24dc2d05366eaee77bb4af1ff /usr.sbin/config/mkmakefile.c | |
parent | 9304d12ab0848c8f804d5bfc4d3007b8b1272e79 (diff) |
Don't access buf[strlen(buf) - 1] for zero-length strings.
OK jaredy@.
Diffstat (limited to 'usr.sbin/config/mkmakefile.c')
-rw-r--r-- | usr.sbin/config/mkmakefile.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c index 7d12f1113e5..b0079afaf8c 100644 --- a/usr.sbin/config/mkmakefile.c +++ b/usr.sbin/config/mkmakefile.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkmakefile.c,v 1.20 2006/05/06 11:31:46 espie Exp $ */ +/* $OpenBSD: mkmakefile.c,v 1.21 2006/12/06 05:05:16 ray Exp $ */ /* $NetBSD: mkmakefile.c,v 1.34 1997/02/02 21:12:36 thorpej Exp $ */ /* @@ -391,6 +391,10 @@ emitrules1(FILE *fp, const char *suffix, const char *rule_prefix, int ruleindex) return (1); if ((cp = fi->fi_mkrule[ruleindex]) == NULL) { cp = rule_prefix; + if (fpath[0] == '\0') { + errno = ENOENT; + return (1); + } ch = fpath[strlen(fpath) - 1]; if (islower(ch)) ch = toupper(ch); |