From: Ilia Alshanetsky Date: Mon, 18 Oct 2004 22:43:29 +0000 (+0000) Subject: MFH: Fixed bug #30475 (curl_getinfo() may crash in some situations). X-Git-Tag: php-4.3.10RC1~50 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5b683f14f5c9c9c75dca902f640c7114de187c1f;p=php MFH: Fixed bug #30475 (curl_getinfo() may crash in some situations). --- diff --git a/NEWS b/NEWS index deebc0eb8e..a0f5d859cf 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,7 @@ PHP 4 NEWS - Fixed a bug in addslashes() handling of the '\0' character. (Ilia) - Backported Marcus' foreach() speedup patch from PHP 5.x. (Derick) - Fixed potential problems with unserializing invalid serialize data. (Marcus) +- Fixed bug #30475 (curl_getinfo() may crash in some situations). (Ilia) - Fixed bug #30442 (segfault when parsing ?getvariable[][ ). (Tony) - Fixed bug #30282 (segfault when using unknown/unsupported session.save_handler and/or session.serialize_handler). (Tony) @@ -14,7 +15,7 @@ PHP 4 NEWS (Ilia) - Fixed bug #30057 (did not detect IPV6 on FreeBSD 4.1). (Wez) - Fixed bug #30027 (Possible crash inside ftp_get()). - (cfield at affinitysolutions dot com + (cfield at affinitysolutions dot com) - Fixed bug #29805 (HTTP Authentication Issues). (Uwe Schindler) - Fixed bug #28325 (Circular references not properly serialised). (Moriyoshi) - Fixed bug #27469 (serialize() objects of incomplete class). (Dmitry) diff --git a/ext/curl/curl.c b/ext/curl/curl.c index 59104b25db..f06e7587ac 100644 --- a/ext/curl/curl.c +++ b/ext/curl/curl.c @@ -1207,10 +1207,13 @@ PHP_FUNCTION(curl_getinfo) switch (option) { case CURLINFO_EFFECTIVE_URL: case CURLINFO_CONTENT_TYPE: { - char *s_code; + char *s_code = NULL; - curl_easy_getinfo(ch->cp, option, &s_code); - RETURN_STRING(s_code, 1); + if (curl_easy_getinfo(ch->cp, option, &s_code) == CURLE_OK && s_code) { + RETURN_STRING(s_code, 1); + } else { + RETURN_FALSE; + } break; } @@ -1220,10 +1223,13 @@ PHP_FUNCTION(curl_getinfo) case CURLINFO_FILETIME: case CURLINFO_SSL_VERIFYRESULT: case CURLINFO_REDIRECT_COUNT: { - long code; + long code = 0; - curl_easy_getinfo(ch->cp, option, &code); - RETURN_LONG(code); + if (curl_easy_getinfo(ch->cp, option, &code) == CURLE_OK) { + RETURN_LONG(code); + } else { + RETURN_FALSE; + } break; } @@ -1239,10 +1245,13 @@ PHP_FUNCTION(curl_getinfo) case CURLINFO_CONTENT_LENGTH_UPLOAD: case CURLINFO_STARTTRANSFER_TIME: case CURLINFO_REDIRECT_TIME: { - double code; + double code = 0.0; - curl_easy_getinfo(ch->cp, option, &code); - RETURN_DOUBLE(code); + if (curl_easy_getinfo(ch->cp, option, &code) == CURLE_OK) { + RETURN_DOUBLE(code); + } else { + RETURN_FALSE; + } break; }