From: Frank Denis Date: Thu, 21 Feb 2019 15:10:27 +0000 (+0100) Subject: Fix bug #77646 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ad3dac378e019590855c462ac69d1bda421520bb;p=php Fix bug #77646 --- diff --git a/NEWS b/NEWS index 52a5783aca..1f1df23f08 100644 --- a/NEWS +++ b/NEWS @@ -19,4 +19,7 @@ PHP NEWS - phpdbg: . Fixed bug #76596 (phpdbg support for display_errors=stderr). (kabel) +- sodium: + . Fixed bug #77646 (sign_detached() strings not terminated). (jedisct1) + <<< NOTE: Insert NEWS from last stable release here prior to actual release! >>> diff --git a/ext/sodium/libsodium.c b/ext/sodium/libsodium.c index c70b9df9ff..2039d97cf3 100644 --- a/ext/sodium/libsodium.c +++ b/ext/sodium/libsodium.c @@ -1677,7 +1677,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_NEW_STR(signature); }