pike.git/
src/
stralloc.c
Branch:
Tag:
Non-build tags
All tags
No tags
2013-08-01
2013-08-01 22:15:18 by Arne Goedeke <el@laramies.com>
5739836708e59d34c6b60028a97425964539153e (
11
lines) (+
6
/-
5
)
[
Show
|
Annotate
]
Branch:
7.9
avoid out of bounds access
3561:
if(!WIDE_ISALNUM(c) || (xx = DIGIT(c)) >= base) return 0; /* No number formed. */
-
if(
(base==16 || base == 2) &&
c == '0' &&
-
INDEX_PCHARP(str,2) < 256 && /* Don't trust isxdigit... */
-
isxdigit(INDEX_PCHARP(str,2)) &&
+
if(c == '0' &&
((base==16 && (INDEX_PCHARP(str,1)=='x' || INDEX_PCHARP(str,1)=='X')) ||
-
(base==2 && (INDEX_PCHARP(str,1)=='b' || INDEX_PCHARP(str,1)=='B'))))
+
(base==2 && (INDEX_PCHARP(str,1)=='b' || INDEX_PCHARP(str,1)=='B')))
&&
+
INDEX_PCHARP(str,2
)
< 256 && /* Don't trust isxdigit... */
+
isxdigit(INDEX_PCHARP(str,2)))
{ /* Skip over leading "0x", "0X", "0b" or "0B". */ INC_PCHARP(str,2);