From f6d7af21a399979952ac4b4f066c42c7e167f5bf Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 14 Aug 2020 15:51:00 +0200 Subject: [PATCH] Null terminate the sodium_crypto_kx_keypair() result --- ext/sodium/libsodium.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/sodium/libsodium.c b/ext/sodium/libsodium.c index 32e54dc05f..142393b7c2 100644 --- a/ext/sodium/libsodium.c +++ b/ext/sodium/libsodium.c @@ -2885,6 +2885,7 @@ PHP_FUNCTION(sodium_crypto_kx_keypair) zend_throw_exception(sodium_exception_ce, "internal error", 0); return; } + ZSTR_VAL(keypair)[crypto_kx_SECRETKEYBYTES + crypto_kx_PUBLICKEYBYTES] = 0; RETURN_STR(keypair); } -- 2.40.0