|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71563 Buffer Overrun in curl_exec() causing hang
Submitted: 2016-02-09 21:20 UTC Modified: 2016-02-28 04:22 UTC
From: paul at salesintel dot com Assigned:
Status: No Feedback Package: cURL related
PHP Version: 7.0.3 OS: Windows 10 x64
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
2 + 9 = ?
Subscribe to this entry?

 [2016-02-09 21:20 UTC] paul at salesintel dot com
When a couple of cURL options are set in a specific and valid way, curl_exec() never returns and PHP does not throw any exception, causing indefinite hang.

Same code in php 5.6.x (in each x32/x64 ts/nts) worked as expected.

In php 7.0.3 (x32/x64 nts, ts not tried) hang occurs.

Test script:
function repo() {
	$location = '';
	$request = "01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234";

	$ch = curl_init($location);
	curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
	curl_setopt($ch, CURLOPT_USERPWD, ' ');

	$response = curl_exec($ch);

Expected result:
Call to curl_exec($ch) returns.

Actual result:
Call to curl_exec($ch) never returns.


If you change $location to an invalid endpoint or one that does not require NTLM, curl_exec() returns.

If you remove the 'CURLAUTH_BASIC' leaving only 'CURLAUTH_NTLM', curl_exec() returns;

If you remove 'CURLAUTH_NTLM' leaving only 'CURLAUTH_BASIC', curl_exec() returns;

If you set an empty string ('') instead of one with one or more characters to CURLOPT_USERPWD, curl_exec() returns.

$request is a string with 1025 characters. If you remove one character, leaving a (suspiciously sized) 1024 character length $request, curl_exec($ch) returns.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-02-16 16:15 UTC]
-Status: Open +Status: Feedback
 [2016-02-16 16:15 UTC]
Thanks for the report. I'm unable to reproduce the behavior with the snippet you've posted. Neither with the original, nor when i replace the request string with like $request = str_repeat('x', 1025);. The script always terminates fast. Is there some other condition i could possibly have overseen?

 [2016-02-28 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Aug 03 20:01:24 2020 UTC