summaryrefslogtreecommitdiff
path: root/bin/ksh/var.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-08-05 20:52:28 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-08-05 20:52:28 +0000
commite6d7f2bf28c8575f152f2be9088bdf919c6d1bd1 (patch)
tree011b8569e906320020188c89b866804e26407c73 /bin/ksh/var.c
parent84e0d42775060101744111a75a5ed2090a4f2df9 (diff)
Don't allow alloc() and aresize() to fail. Their return value was
only checked in two place (both in conjunction with str_save). Upon malloc/realloc failure we call internal_errorf() which pops throws and error and pops back to the last good state. OK deraadt@ pval@ fgs@ Original problem noted by mickey@
Diffstat (limited to 'bin/ksh/var.c')
-rw-r--r--bin/ksh/var.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/bin/ksh/var.c b/bin/ksh/var.c
index 400e4f629b3..8d3eacb37d2 100644
--- a/bin/ksh/var.c
+++ b/bin/ksh/var.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: var.c,v 1.15 2003/06/26 00:09:45 deraadt Exp $ */
+/* $OpenBSD: var.c,v 1.16 2003/08/05 20:52:27 millert Exp $ */
#include "sh.h"
#include "ksh_time.h"
@@ -385,8 +385,7 @@ setstr(vq, s, error_ok)
export(vq, s);
else {
vq->val.s = str_save(s, vq->areap);
- if (vq->val.s) /* <sjg> don't lie */
- vq->flag |= ALLOC;
+ vq->flag |= ALLOC;
}
} else /* integer dest */
if (!v_evaluate(vq, s, error_ok))