diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2017-07-21 09:29:43 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2017-07-21 09:29:43 +0000 |
commit | 4d6508badfe05e2356ed7f18d438c9b3d3d07be2 (patch) | |
tree | c8bd3ee4f5a89cd4767fa47bae3a79db9bf667fb | |
parent | f41e5d0d6375058ebe0b23e6866218e4d8931536 (diff) |
fix two nasty out-of-bound accesses that killed (sporadically mk38 and mk38bis.
prodded by bluhm@, okay bluhm@
-rw-r--r-- | usr.bin/make/arch.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/make/arch.c b/usr.bin/make/arch.c index fb65cc64843..7d37879f826 100644 --- a/usr.bin/make/arch.c +++ b/usr.bin/make/arch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arch.c,v 1.87 2016/10/21 16:12:38 espie Exp $ */ +/* $OpenBSD: arch.c,v 1.88 2017/07/21 09:29:42 espie Exp $ */ /* $NetBSD: arch.c,v 1.17 1996/11/06 17:58:59 christos Exp $ */ /* @@ -242,6 +242,10 @@ parse_archive(Buffer expand, const char **linePtr, Lst nodeLst, SymTable *ctxt) elib = lib + strlen(lib); } + if (*cp == '\0') { + printf("Unclosed parenthesis in archive specification\n"); + return false; + } cp++; /* iterate on members, that may be separated by spaces */ for (;;) { @@ -266,7 +270,7 @@ parse_archive(Buffer expand, const char **linePtr, Lst nodeLst, SymTable *ctxt) * chances are there's something wrong (like a missing * backslash), so it's better to return failure than allow such * things to happen. */ - if (*cp == '\0') { + if (*cp == '\0' || ISSPACE(*cp)) { printf("No closing parenthesis in archive specification\n"); return false; } |