Skip to content

Commit 75d7dca

Browse files
committed
fix segfault in sqlcipher_cipher_ctx_cmp CODEC_TRACE during rekey
1 parent 8bc752f commit 75d7dca

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/crypto_impl.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,11 @@ static int sqlcipher_cipher_ctx_cmp(cipher_ctx *c1, cipher_ctx *c2) {
431431
c1->pass, c2->pass,
432432
c1->pass, c2->pass,
433433
c1->provider->ctx_cmp(c1->provider_ctx, c2->provider_ctx),
434-
sqlcipher_memcmp((const unsigned char*)c1->pass,
435-
(const unsigned char*)c2->pass,
436-
c1->pass_sz),
434+
(c1->pass == NULL || c2->pass == NULL)
435+
? -1 : sqlcipher_memcmp(
436+
(const unsigned char*)c1->pass,
437+
(const unsigned char*)c2->pass,
438+
c1->pass_sz),
437439
are_equal
438440
);
439441

0 commit comments

Comments
 (0)