We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 992e5a7 commit ba2a1f5Copy full SHA for ba2a1f5
1 file changed
ext/uri/uri_parser_rfc3986.c
@@ -240,10 +240,12 @@ ZEND_ATTRIBUTE_NONNULL static zend_result php_uri_parser_rfc3986_host_read(void
240
const size_t host_len = get_text_range_length(&uriparser_uri->hostText);
241
zend_string *host_str = zend_string_alloc(host_len + 2, false);
242
243
- ZSTR_VAL(host_str)[0] = '[';
244
- memcpy(ZSTR_VAL(host_str) + 1, uriparser_uri->hostText.first, host_len);
245
- ZSTR_VAL(host_str)[host_len + 1] = ']';
246
- ZSTR_VAL(host_str)[host_len + 2] = '\0';
+ char *out = ZSTR_VAL(host_str);
+
+ *(out++) = '[';
+ out = zend_mempcpy(out, uriparser_uri->hostText.first, host_len);
247
+ *(out++) = ']';
248
+ *out = '\0';
249
250
ZVAL_STR(retval, host_str);
251
} else {
0 commit comments