aboutsummaryrefslogtreecommitdiffstats
path: root/int_array.c
diff options
context:
space:
mode:
Diffstat (limited to 'int_array.c')
-rw-r--r--int_array.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/int_array.c b/int_array.c
index 937a91cf..9981fafe 100644
--- a/int_array.c
+++ b/int_array.c
@@ -128,6 +128,7 @@ is_integer(NODE *symbol, NODE *subs)
/* must be a STRING */
char *cp = subs->stptr, *cpend, *ptr;
+ char save;
size_t len = subs->stlen;
if (len == 0 || (! isdigit((unsigned char) *cp) && *cp != '-'))
@@ -151,9 +152,12 @@ is_integer(NODE *symbol, NODE *subs)
}
cpend = cp + len;
+ save = *cpend;
+ *cpend = '\0';
errno = 0;
l = strtol(cp, & ptr, 10);
+ *cpend = save;
if (errno != 0 || ptr != cpend)
return NULL;