Skip to content

Commit 791700d

Browse files
committed
Change namelen to size_t because it is always unsigned and less in size than size_t
1 parent f985667 commit 791700d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

ext/session/session.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -904,10 +904,9 @@ PS_SERIALIZER_DECODE_FUNC(php_binary) /* {{{ */
904904
PHP_VAR_UNSERIALIZE_INIT(var_hash);
905905

906906
for (p = val; p < endptr; ) {
907-
// Can this be changed to size_t?
908-
int namelen = ((unsigned char)(*p)) & (~PS_BIN_UNDEF);
907+
size_t namelen = ((unsigned char)(*p)) & (~PS_BIN_UNDEF);
909908

910-
if (namelen < 0 || namelen > PS_BIN_MAX || (p + namelen) >= endptr) {
909+
if (namelen > PS_BIN_MAX || (p + namelen) >= endptr) {
911910
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
912911
return FAILURE;
913912
}

0 commit comments

Comments
 (0)