Skip to content

Commit d03a94a

Browse files
committed
Use proper types in sodium_crypto_stream_xchacha20_xor_ic()
Most importantly, `ic` needs to be of type `zend_long`, not `zend_long*`. Closes GH-8302.
1 parent 2fe35cf commit d03a94a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/sodium/libsodium.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,7 +1585,7 @@ PHP_FUNCTION(sodium_crypto_stream_xchacha20_xor_ic)
15851585
unsigned char *key;
15861586
unsigned char *msg;
15871587
unsigned char *nonce;
1588-
zend_long *ic;
1588+
zend_long ic;
15891589

15901590
size_t ciphertext_len;
15911591
size_t key_len;
@@ -1612,7 +1612,7 @@ PHP_FUNCTION(sodium_crypto_stream_xchacha20_xor_ic)
16121612
ciphertext = zend_string_checked_alloc((size_t) ciphertext_len, 0);
16131613
if (crypto_stream_xchacha20_xor_ic((unsigned char *) ZSTR_VAL(ciphertext), msg,
16141614
(unsigned long long) msg_len, nonce,
1615-
(unsigned long long) ic, key) != 0) {
1615+
(uint64_t) ic, key) != 0) {
16161616
zend_string_free(ciphertext);
16171617
zend_throw_exception(sodium_exception_ce, "internal error", 0);
16181618
RETURN_THROWS();

0 commit comments

Comments
 (0)