Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions ext/curl/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -1625,6 +1625,23 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue
CURLcode error = CURLE_OK;
zend_long lval;

if (Z_TYPE_P(zvalue) == IS_OBJECT
&& instanceof_function(Z_OBJCE_P(zvalue), zend_ce_sensitive_parameter_value))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for instanceof, SensitiveParameterValue is final. You can just compare the CE directly.

{
zval rv;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This theoretically leaks rv. But we know that SensitiveParameterValue is final and has a real backing store for the property and &rv is unused. I would therefore suggest to just pass NULL instead of &rv.

zval *inner_value;

inner_value = zend_read_property_ex(
zend_ce_sensitive_parameter_value,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
zend_ce_sensitive_parameter_value,
Z_OBJCE_P(zvalue),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree with the suggestion - why do a lookup when we know the class type?

Z_OBJ_P(zvalue),
ZSTR_KNOWN(ZEND_STR_VALUE),
0,
&rv
);

zvalue = inner_value;
}

switch (option) {
/* Callable options */
HANDLE_CURL_OPTION_CALLABLE_PHP_CURL_USER(ch, CURLOPT_WRITE, write, PHP_CURL_STDOUT);
Expand Down
Loading