summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorjmallett <jmallett@FreeBSD.org>2002-11-08 16:59:11 +0000
committerjmallett <jmallett@FreeBSD.org>2002-11-08 16:59:11 +0000
commit5c2d1427fb6a9333bffb46166548a54dbb86013d (patch)
tree60287c57d081c9fbc8c99465321ff52c15b7380e /usr.bin
parent38900b3ee31801dfd573c3b6a8f0fb7d1e490b9a (diff)
downloadFreeBSD-src-5c2d1427fb6a9333bffb46166548a54dbb86013d.zip
FreeBSD-src-5c2d1427fb6a9333bffb46166548a54dbb86013d.tar.gz
Convert some broken cases where Error is called, but we try to continue,
to Fatal errors, because the logic that we use to try to continue is far too broken, and makes things look and act weird, because we end up pointing past the end of a buffer boundry into freed memory in the caller, as we don't come close to setting the lengthPtr to a sane value. Reviewed by: make@ (This only changes failure cases which would have died horrid deaths to explicit clean death failure cases.)
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/make/var.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c
index 6d3093a..b5b2b02 100644
--- a/usr.bin/make/var.c
+++ b/usr.bin/make/var.c
@@ -1268,17 +1268,11 @@ Var_Parse(char *str, GNode *ctxt, Boolean err, int *lengthPtr, Boolean *freePtr)
/*
* If lhs didn't end with the delimiter, complain and
- * return NULL
+ * exit.
*/
if (*cp != del) {
- *lengthPtr = cp - start + 1;
- if (*freePtr) {
- free(str);
- }
- Buf_Destroy(buf, TRUE);
- Error("Unclosed substitution for %s (%c missing)",
+ Fatal("Unclosed substitution for %s (%c missing)",
v->name, del);
- return (var_Error);
}
/*
@@ -1336,14 +1330,8 @@ Var_Parse(char *str, GNode *ctxt, Boolean err, int *lengthPtr, Boolean *freePtr)
* If didn't end in delimiter character, complain
*/
if (*cp != del) {
- *lengthPtr = cp - start + 1;
- if (*freePtr) {
- free(str);
- }
- Buf_Destroy(buf, TRUE);
- Error("Unclosed substitution for %s (%c missing)",
+ Fatal("Unclosed substitution for %s (%c missing)",
v->name, del);
- return (var_Error);
}
pattern.rhs = (char *)Buf_GetAll(buf, &pattern.rightLen);
@@ -1390,7 +1378,7 @@ Var_Parse(char *str, GNode *ctxt, Boolean err, int *lengthPtr, Boolean *freePtr)
if (*freePtr)
free(str);
if (delim != '\0')
- Error("Unclosed substitution for %s (%c missing)",
+ Fatal("Unclosed substitution for %s (%c missing)",
v->name, delim);
return (var_Error);
}
@@ -1404,7 +1392,7 @@ Var_Parse(char *str, GNode *ctxt, Boolean err, int *lengthPtr, Boolean *freePtr)
if (*freePtr)
free(str);
if (delim != '\0')
- Error("Unclosed substitution for %s (%c missing)",
+ Fatal("Unclosed substitution for %s (%c missing)",
v->name, delim);
return (var_Error);
}
OpenPOWER on IntegriCloud