From: Joe Orton Date: Thu, 6 Jan 2005 10:21:09 +0000 (+0000) Subject: MFH: - Fixed bug #31413 (curl POSTFIELDS crashes on 64-bit platforms). X-Git-Tag: php-5.0.4RC1~386 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a58c381adeca9b34f453f24f3fca2c2f0ac7e531;p=php MFH: - Fixed bug #31413 (curl POSTFIELDS crashes on 64-bit platforms). --- diff --git a/NEWS b/NEWS index 6135921753..d9fc4bbc3c 100644 --- 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) diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 2e6d84cc26..c9fed7cafb 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -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); } }