]> granicus.if.org Git - php/commitdiff
MFH: Fixed bug #30475 (curl_getinfo() may crash in some situations).
authorIlia Alshanetsky <iliaa@php.net>
Mon, 18 Oct 2004 22:43:29 +0000 (22:43 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Mon, 18 Oct 2004 22:43:29 +0000 (22:43 +0000)
NEWS
ext/curl/curl.c

diff --git a/NEWS b/NEWS
index deebc0eb8e4b21e27b2f94dab8fa30bc06673d5a..a0f5d859cfa432fbf306d1b511c07adad3eab4a0 100644 (file)
--- 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)
index 59104b25db2979c0d2f1137e58c36710897cfdbb..f06e7587ac6b14b15fc4d4be04d5f3ac8a92c2f1 100644 (file)
@@ -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;
                }