Skip to content

Commit 0ad81ac

Browse files
author
Yasuo Ohgaki
committed
Fixed possible buffer overflow under Windows. Note: Not a security fix.
1 parent e9b128c commit 0ad81ac

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/session/session.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ PHPAPI char *php_session_create_id(PS_CREATE_SID_ARGS) /* {{{ */
341341
unsigned char rbuf[2048];
342342
size_t toread = PS(entropy_length);
343343

344-
if (php_win32_get_random_bytes(rbuf, (size_t) toread) == SUCCESS){
344+
if (php_win32_get_random_bytes(rbuf, MIN(toread, sizeof(rbuf))) == SUCCESS){
345345

346346
switch (PS(hash_func)) {
347347
case PS_HASH_FUNC_MD5:

0 commit comments

Comments
 (0)