From 5757e9ac3ed9dd21f0db13c012c60ea7c9fa268f Mon Sep 17 00:00:00 2001 From: Ray Lai Date: Wed, 6 Dec 2006 05:05:17 +0000 Subject: Don't access buf[strlen(buf) - 1] for zero-length strings. OK jaredy@. --- usr.sbin/config/mkmakefile.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'usr.sbin/config/mkmakefile.c') 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); -- cgit v1.2.3