summaryrefslogtreecommitdiff
path: root/ext/com_dotnet/php_com_dotnet_internal.h
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2020-06-29 17:38:14 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2020-06-29 19:05:02 +0200
commita385cfa7ad7fe3621bb6095ff88bc8d74b358df0 (patch)
tree75babdefc6eb3793530945a6a4aa43c6c36666ba /ext/com_dotnet/php_com_dotnet_internal.h
parent816b4c1235d70b1b83d26c415f044fc04a48875f (diff)
downloadphp-git-a385cfa7ad7fe3621bb6095ff88bc8d74b358df0.tar.gz
Fix #63208: BSTR to PHP string conversion not binary safe
A `BSTR` is similar to a `zend_string`; it stores the length of the string just before the actual string, and thus the string may contain NUL bytes. However, `php_com_olestring_to_string()` is supposed to deal with arbitrary `OLECHAR*`s which may not be `BSTR`s, so we introduce `php_com_bstr_to_string()` and use it for the only case where we actually have to deal with `BSTR`s which may contain NUL bytes. Contrary to `php_com_olestring_to_string()` we return a `zend_string`, so we can save the re-allocation when converting to a `zval`. We also cater to `php_com_string_to_olestring()` not being binary safe, with basically the same fix we did for `php_com_olestring_to_string()`.
Diffstat (limited to 'ext/com_dotnet/php_com_dotnet_internal.h')
-rw-r--r--ext/com_dotnet/php_com_dotnet_internal.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/ext/com_dotnet/php_com_dotnet_internal.h b/ext/com_dotnet/php_com_dotnet_internal.h
index a2fe813683..663c0694fe 100644
--- a/ext/com_dotnet/php_com_dotnet_internal.h
+++ b/ext/com_dotnet/php_com_dotnet_internal.h
@@ -89,6 +89,8 @@ PHP_COM_DOTNET_API char *php_com_olestring_to_string(OLECHAR *olestring,
size_t *string_len, int codepage);
PHP_COM_DOTNET_API OLECHAR *php_com_string_to_olestring(char *string,
size_t string_len, int codepage);
+BSTR php_com_string_to_bstr(zend_string *string, int codepage);
+zend_string *php_com_bstr_to_string(BSTR bstr, int codepage);
/* com_com.c */