Skip to content

Commit ad3dac3

Browse files
committed
Fix bug #77646
1 parent 1cae9f2 commit ad3dac3

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@ PHP NEWS
1919
- phpdbg:
2020
. Fixed bug #76596 (phpdbg support for display_errors=stderr). (kabel)
2121

22+
- sodium:
23+
. Fixed bug #77646 (sign_detached() strings not terminated). (jedisct1)
24+
2225
<<< NOTE: Insert NEWS from last stable release here prior to actual release! >>>

ext/sodium/libsodium.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1677,7 +1677,8 @@ PHP_FUNCTION(sodium_crypto_sign_detached)
16771677
zend_throw_exception(sodium_exception_ce, "signature has a bogus size", 0);
16781678
return;
16791679
}
1680-
ZEND_ASSERT(ZSTR_VAL(signature)[signature_real_len] == 0);
1680+
PHP_SODIUM_ZSTR_TRUNCATE(signature, (size_t) signature_real_len);
1681+
ZSTR_VAL(signature)[signature_real_len] = 0;
16811682

16821683
RETURN_NEW_STR(signature);
16831684
}

0 commit comments

Comments
 (0)