From: Ilia Alshanetsky Date: Sun, 31 Dec 2006 22:25:55 +0000 (+0000) Subject: Added boundary checks to php_binary deserializer X-Git-Tag: php-5.2.1RC2~24 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ba645539131468b9c5fdc47762f4a4bc744bfbf5;p=php Added boundary checks to php_binary deserializer --- diff --git a/ext/session/session.c b/ext/session/session.c index 3fbb5151a7..db2e24a72a 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -471,6 +471,11 @@ PS_SERIALIZER_DECODE_FUNC(php_binary) for (p = val; p < endptr; ) { zval **tmp; namelen = *p & (~PS_BIN_UNDEF); + + if (namelen > PS_BIN_MAX || (p + namelen) >= endptr) { + return FAILURE; + } + has_value = *p & PS_BIN_UNDEF ? 0 : 1; name = estrndup(p + 1, namelen);