]> granicus.if.org Git - php/commitdiff
Fix bug #77646
authorFrank Denis <github@pureftpd.org>
Thu, 21 Feb 2019 15:10:27 +0000 (16:10 +0100)
committerFrank Denis <github@pureftpd.org>
Thu, 21 Feb 2019 15:10:27 +0000 (16:10 +0100)
NEWS
ext/sodium/libsodium.c

diff --git a/NEWS b/NEWS
index 52a5783acaee312411aeedecb276493e957da52a..1f1df23f082a441d802a1c38e5f17feae7ebf10c 100644 (file)
--- 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! >>>
index c70b9df9ff2efd68ea6d768cdb2bef080719a0b3..2039d97cf37fb0109d4c99b5097a58e9e9f0c5d6 100644 (file)
@@ -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);
 }