Skip to content

Commit aeb6a6c

Browse files
author
Moriyoshi Koizumi
committed
Fixed possible buffer overflow in php_base64_decode();
# This bug doesn't appear to be harmful for now, # so I won't merge it into branches...
1 parent 39e03b5 commit aeb6a6c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/standard/base64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ unsigned char *php_base64_decode(const unsigned char *str, int length, int *ret_
140140
}
141141

142142
/* run through the whole string, converting as we go */
143-
while ((ch = *current++) != '\0') {
143+
while ((ch = *current++) != '\0' && length-- > 0) {
144144
if (ch == base64_pad) break;
145145

146146
/* When Base64 gets POSTed, all pluses are interpreted as spaces.

0 commit comments

Comments
 (0)