summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorxXx-caillou-xXx2017-12-19 18:14:41 +0100
committerjvoisin2017-12-19 18:14:41 +0100
commitf7dfc937ebc7317fd3ff168e062d32119913d7ae (patch)
tree448658cd7a6ed1cfcbb30340632d28e74cf96dad /src
parent05906ca8dc18fce72fea2287b006157c08dc9e81 (diff)
Fix a segfault related to cookies
Apparently, PHP doesn't like when you're trying to save some memory when you're playing with strings.
Diffstat (limited to 'src')
-rw-r--r--src/sp_cookie_encryption.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/sp_cookie_encryption.c b/src/sp_cookie_encryption.c
index 2bb305f..2d6c938 100644
--- a/src/sp_cookie_encryption.c
+++ b/src/sp_cookie_encryption.c
@@ -209,10 +209,10 @@ PHP_FUNCTION(sp_setcookie) {
209 cookie_samesite = (cookie_node->samesite == lax) ? SAMESITE_COOKIE_FORMAT SP_TOKEN_SAMESITE_LAX 209 cookie_samesite = (cookie_node->samesite == lax) ? SAMESITE_COOKIE_FORMAT SP_TOKEN_SAMESITE_LAX
210 : SAMESITE_COOKIE_FORMAT SP_TOKEN_SAMESITE_STRICT; 210 : SAMESITE_COOKIE_FORMAT SP_TOKEN_SAMESITE_STRICT;
211 /* Concatenating everything, as is in PHP internals */ 211 /* Concatenating everything, as is in PHP internals */
212 samesite = zend_string_extend(path, ZSTR_LEN(path) + strlen(cookie_samesite) + 1, 0); 212 samesite = zend_string_init(ZSTR_VAL(path), ZSTR_LEN(path), 0);
213 samesite = zend_string_extend(samesite, ZSTR_LEN(path) + strlen(cookie_samesite) + 1, 0);
213 memcpy(ZSTR_VAL(samesite) + ZSTR_LEN(path), cookie_samesite, strlen(cookie_samesite) + 1); 214 memcpy(ZSTR_VAL(samesite) + ZSTR_LEN(path), cookie_samesite, strlen(cookie_samesite) + 1);
214 ZVAL_STR_COPY(&params[3], samesite); 215 ZVAL_STR_COPY(&params[3], samesite);
215 zend_string_release(path);
216 } else if (path) { 216 } else if (path) {
217 ZVAL_STR_COPY(&params[3], path); 217 ZVAL_STR_COPY(&params[3], path);
218 } 218 }