php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #77646
Patch sodium_crypto_sign_detached-zero-termination.patch revision 2019-02-21 13:15 UTC by thomaswouters+bugs dot php dot net at gmail dot com

Patch sodium_crypto_sign_detached-zero-termination.patch for *Encryption and hash functions Bug #77646

Patch version 2019-02-21 13:15 UTC

Return to Bug #77646 | Download this patch
Patch Revisions:

Developer: thomaswouters+bugs.php.net@gmail.com

--- a/ext/sodium/libsodium.c
+++ b/ext/sodium/libsodium.c
@@ -1677,7 +1677,8 @@
 		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);
 }
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 17:01:30 2024 UTC