php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9181 curl_setopt options causes seg faults
Submitted: 2001-02-08 15:35 UTC Modified: 2001-02-16 09:34 UTC
From: wmartino at webmachines dot com Assigned:
Status: Closed Package: Reproducible Crash
PHP Version: 4.0.4pl1 OS: Redhat Linux 6.1
Private report: No CVE-ID: None
 [2001-02-08 15:35 UTC] wmartino at webmachines dot com
curl_setopt with the options CURLOPT_HTTPHEADER, CURLOPT_QUOTE, and CURLOPT_POSTQUOTE used with a scalar value cause php to seg fault.  In curl.c:149, there is a typo where the constant name CURLOPT_HTTPHEADER is assigned to CURLOPT_HTTP.  Also, in several places, the code for the function if_curl_setopt assumes that curl_value is an aggregate type, when it may be a single string.  (Notably in the case statements for CURLOPT_HTTPHEADER,CURLOPT_POSTQUOTE, and CURLOPT_QUOTE. )  Lastly, in some places where a curl_slist is being built, memory is allocated for the first node when it should not be.  (Memory is allocated inside of curl_slist_append).
If you write a script that uses the CURLOPT_HTTPHEADER, or the others, you can easily reproduce this.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-15 11:30 UTC] sniper@php.net
At least the typo is fixed in CVS. Could you please try the latest CVS snapshot
from http://snaps.php.net/  to see  which problems still are valid?

I assign this to Sterling who promised to fix the possible bugs in a 2 to 3 weeks.

--Jani

 [2001-02-15 13:25 UTC] wmartino at webmachines dot com
Looks like the typo is still there in the snapshot for Feb. 15, 2001 in curl.c
on line 143.
 REGISTER_LONG_CONSTANT("CURLOPT_HTTPHEADER", CURLOPT_HEADER, CONST_CS | CONST_PERSISTENT);

I changed this to :
 REGISTER_LONG_CONSTANT("CURLOPT_HTTPHEADER", CURLOPT_HTTPHEADER, CONST_CS | CONST_PERSISTENT);

and fixed the other bug for HTTPHEADER(see above comment) in the definition for curl_setopt.  And this seemed to give the desired functionality.

Also, a correction to the previous comment: the problems I noted were not in if_curl_setopt, but in the definition for the curl_setopt function in curl.c.
 [2001-02-16 09:34 UTC] sniper@php.net
This is now fixed in CVS.

--Jani

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 10:01:28 2024 UTC