From 9fca0051a65c0c27d719444867bf4fe651862074 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Fri, 24 Oct 2008 10:46:05 +0000 Subject: [PATCH] - MFH: Fixed bug #46082 (stream_set_blocking() can cause a crash in some circumstances) --- NEWS | 2 ++ main/network.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index b3e1b1c7fd..a8a3b49d88 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,8 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? Nov 2008, PHP 5.2.7RC3 +- Fixed bug #46082 (stream_set_blocking() can cause a crash in some + circumstances). (Felipe) 23 Oct 2008, PHP 5.2.7RC2 - Upgraded bundled libzip to 0.9.0. (Pierre) diff --git a/main/network.c b/main/network.c index d0b710e560..6c1028a6bd 100644 --- a/main/network.c +++ b/main/network.c @@ -1051,7 +1051,11 @@ PHPAPI int php_set_sock_blocking(int socketd, int block TSRMLS_DC) /* with ioctlsocket, a non-zero sets nonblocking, a zero sets blocking */ flags = !block; if (ioctlsocket(socketd, FIONBIO, &flags) == SOCKET_ERROR) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", WSAGetLastError()); + char *error_string; + + error_string = php_socket_strerror(WSAGetLastError(), NULL, 0); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", error_string); + efree(error_string); ret = FAILURE; } #else -- 2.40.0