]> granicus.if.org Git - php/commitdiff
MFH: - Fixed bug #31413 (curl POSTFIELDS crashes on 64-bit platforms).
authorJoe Orton <jorton@php.net>
Thu, 6 Jan 2005 10:21:09 +0000 (10:21 +0000)
committerJoe Orton <jorton@php.net>
Thu, 6 Jan 2005 10:21:09 +0000 (10:21 +0000)
NEWS
ext/curl/interface.c

diff --git a/NEWS b/NEWS
index 613592175353e42c552d13b11a9f95a9042361e9..d9fc4bbc3c3ef23acf1441f0735108a1dbebc76b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ PHP                                                                        NEWS
 - Added Oracle Instant Client support. (cjbj at hotmail dot com, Tony)
 - Added length and charsetnr for field array and object in mysqli. (Georg)
 - Fixed a bug in mysqli_stmt_execute() (type conversion with NULL values). (Georg)
+- Fixed bug #31413 (curl POSTFIELDS crashes on 64-bit platforms). (Joe)
 - Fixed bug #31396 (compile fails with gd 2.0.33 without freetype). (Jani)
 - Fixed bug #31371 (highlight_file() trims new line after heredoc). (Ilia)
 - Fixed bug #31361 (simplexml/domxml segfault when adding node twice). (Rob)
index 2e6d84cc267557d3b4380f6ea6b0ecc18be422b5..c9fed7cafbd2c860ef4a5f40c1142d5b3669e867 100644 (file)
@@ -1086,18 +1086,22 @@ PHP_FUNCTION(curl_setopt)
                                        zend_hash_get_current_key_ex(postfields, &string_key, &string_key_len, &num_key, 0, NULL);
                                
                                        postval = Z_STRVAL_PP(current);
+
+                                       /* The arguments after _NAMELENGTH and _CONTENTSLENGTH
+                                        * must be explicitly cast to long in curl_formadd
+                                        * use since curl needs a long not an int. */
                                        if (*postval == '@') {
                                                error = curl_formadd(&first, &last, 
                                                                                         CURLFORM_COPYNAME, string_key,
-                                                                                        CURLFORM_NAMELENGTH, string_key_len - 1,
+                                                                                        CURLFORM_NAMELENGTH, (long)string_key_len - 1,
                                                                                         CURLFORM_FILE, ++postval, 
                                                                                         CURLFORM_END);
                                        } else {
                                                error = curl_formadd(&first, &last, 
                                                                                         CURLFORM_COPYNAME, string_key,
-                                                                                        CURLFORM_NAMELENGTH, string_key_len - 1,
+                                                                                        CURLFORM_NAMELENGTH, (long)string_key_len - 1,
                                                                                         CURLFORM_COPYCONTENTS, postval, 
-                                                                                        CURLFORM_CONTENTSLENGTH, Z_STRLEN_PP(current),
+                                                                                        CURLFORM_CONTENTSLENGTH, (long)Z_STRLEN_PP(current),
                                                                                         CURLFORM_END);
                                        }
                                }