From: Stanislav Malyshev Date: Mon, 29 Sep 2014 00:53:49 +0000 (-0700) Subject: Fix bug #68089 - do not accept options with embedded \0 X-Git-Tag: php-5.5.19RC1~18 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d1e030db02f402efebfe2976482dd7e7ebe2956f;p=php Fix bug #68089 - do not accept options with embedded \0 Conflicts: ext/curl/interface.c --- diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 765918cc35..eab2edf663 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -169,6 +169,11 @@ static int php_curl_option_str(php_curl *ch, long option, const char *str, const { CURLcode error = CURLE_OK; + if (strlen(str) != len) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Curl option contains invalid characters (\\0)"); + return 0; + } + #if LIBCURL_VERSION_NUM >= 0x071100 if (make_copy) { #endif diff --git a/ext/curl/tests/bug68089.phpt b/ext/curl/tests/bug68089.phpt new file mode 100644 index 0000000000..3bd5889709 --- /dev/null +++ b/ext/curl/tests/bug68089.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #68089 (NULL byte injection - cURL lib) +--SKIPIF-- + +--FILE-- + +Done +--EXPECTF-- +Warning: curl_setopt(): Curl option contains invalid characters (\0) in %s/bug68089.php on line 4 +bool(false) +Done