summaryrefslogtreecommitdiff
path: root/braces.c
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2018-09-17 15:10:56 -0400
committerChet Ramey <chet.ramey@case.edu>2018-09-17 15:10:56 -0400
commit2f5dfe5a18b4670eb4cea32c1c76295eb70a8865 (patch)
treebf19e42dcaf6c5cf8e0ce0a1c15d56e8f8a6d675 /braces.c
parent9a51695bed07d37086c352372ac69d0a30039a6b (diff)
downloadbash-2f5dfe5a18b4670eb4cea32c1c76295eb70a8865.tar.gz
bash-5.0-beta releasebash-5.0-beta
Diffstat (limited to 'braces.c')
-rw-r--r--braces.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/braces.c b/braces.c
index 315c62f1..2a255c78 100644
--- a/braces.c
+++ b/braces.c
@@ -1,6 +1,6 @@
/* braces.c -- code for doing word expansion in curly braces. */
-/* Copyright (C) 1987-2012 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2018 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -420,9 +420,9 @@ mkseq (start, end, incr, type, width)
/* Instead of a simple nelem = prevn + 1, something like:
nelem = (prevn / imaxabs(incr)) + 1;
would work */
- nelem = (prevn / sh_imaxabs(incr)) + 1;
- if (nelem > INT_MAX - 2) /* Don't overflow int */
+ if ((prevn / sh_imaxabs (incr)) > INT_MAX - 3) /* check int overflow */
return ((char **)NULL);
+ nelem = (prevn / sh_imaxabs(incr)) + 1;
result = strvec_mcreate (nelem + 1);
if (result == 0)
{
@@ -778,7 +778,9 @@ array_concat (arr1, arr2)
len1 = strvec_len (arr1);
len2 = strvec_len (arr2);
- result = (char **)xmalloc ((1 + (len1 * len2)) * sizeof (char *));
+ result = (char **)malloc ((1 + (len1 * len2)) * sizeof (char *));
+ if (result == 0)
+ return (result);
len = 0;
for (i = 0; i < len1; i++)