Skip to content

Commit b0856e8

Browse files
committed
add null check on inKey
1 parent 6e092fa commit b0856e8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/wh_client_crypto.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2552,8 +2552,10 @@ static int _HkdfMakeKey(whClientContext* ctx, int hashType, whKeyId keyIdIn,
25522552
uint8_t* data_ptr = (uint8_t*)(req + 1);
25532553

25542554
/* Copy input key material */
2555-
memcpy(data_ptr, inKey, inKeySz);
2556-
data_ptr += inKeySz;
2555+
if ((inKey != NULL) && (inKeySz > 0)) {
2556+
memcpy(data_ptr, inKey, inKeySz);
2557+
data_ptr += inKeySz;
2558+
}
25572559

25582560
/* Copy salt if provided */
25592561
if (salt != NULL && saltSz > 0) {

0 commit comments

Comments
 (0)