summaryrefslogtreecommitdiff
path: root/bin/ksh
diff options
context:
space:
mode:
authormmcc <mmcc@cvs.openbsd.org>2015-11-08 17:52:44 +0000
committermmcc <mmcc@cvs.openbsd.org>2015-11-08 17:52:44 +0000
commit9f34da8a6e669295165bb6f5977810f1189f9f52 (patch)
tree0631e366b387e1887e5c95f2cc08f089ed608ab5 /bin/ksh
parentf4f6a53c08df99f9294c116e569fb940b2d50111 (diff)
Tweak a reallocarray call to be more overflow-resistant. From Theo Buehler.
ok nicm@
Diffstat (limited to 'bin/ksh')
-rw-r--r--bin/ksh/expand.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/bin/ksh/expand.h b/bin/ksh/expand.h
index 9ec0e4dddef..9262ef994d8 100644
--- a/bin/ksh/expand.h
+++ b/bin/ksh/expand.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: expand.h,v 1.11 2015/11/05 18:39:34 mmcc Exp $ */
+/* $OpenBSD: expand.h,v 1.12 2015/11/08 17:52:43 mmcc Exp $ */
/*
* Expanding strings
@@ -89,8 +89,8 @@ typedef struct XPtrV {
#define XPput(x, p) do { \
if ((x).cur >= (x).end) { \
int n = XPsize(x); \
- (x).beg = areallocarray((x).beg, n*2, \
- sizeof(void *), ATEMP); \
+ (x).beg = areallocarray((x).beg, n, \
+ 2 * sizeof(void *), ATEMP); \
(x).cur = (x).beg + n; \
(x).end = (x).cur + n; \
} \