summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rw-r--r--ext/sodium/libsodium.c3
2 files changed, 5 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 72d8fac99d..b1280cc2f4 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,9 @@ PHP NEWS
- MySQLi:
. Fixed bug #77597 (mysqli_fetch_field hangs scripts). (Nikita)
+- sodium:
+ . Fixed bug #77646 (sign_detached() strings not terminated). (Frank)
+
07 Mar 2019, PHP 7.2.16
- Core:
diff --git a/ext/sodium/libsodium.c b/ext/sodium/libsodium.c
index cfa5b7d600..f7b3ea4dca 100644
--- a/ext/sodium/libsodium.c
+++ b/ext/sodium/libsodium.c
@@ -1678,7 +1678,8 @@ PHP_FUNCTION(sodium_crypto_sign_detached)
zend_throw_exception(sodium_exception_ce, "signature has a bogus size", 0);
return;
}
- ZEND_ASSERT(ZSTR_VAL(signature)[signature_real_len] == 0);
+ PHP_SODIUM_ZSTR_TRUNCATE(signature, (size_t) signature_real_len);
+ ZSTR_VAL(signature)[signature_real_len] = 0;
RETURN_STR(signature);
}