Skip to content

Commit

Permalink
Fix bug #77646
Browse files Browse the repository at this point in the history
  • Loading branch information
jedisct1 committed Feb 21, 2019
1 parent 934691f commit 08089b5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ PHP NEWS
- MySQLi:
. Fixed bug #77597 (mysqli_fetch_field hangs scripts). (Nikita)

- sodium:
. Fixed bug #77646 (sign_detached() strings not terminated). (Frank)

07 Mar 2019, PHP 7.2.16

- Core:
Expand Down
3 changes: 2 additions & 1 deletion ext/sodium/libsodium.c
Original file line number Diff line number Diff line change
Expand Up @@ -1678,7 +1678,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_STR(signature);
}
Expand Down

0 comments on commit 08089b5

Please sign in to comment.