Skip to content

Commit e523727

Browse files
committed
Add some protection against NULL pointer dereference
1 parent 5559827 commit e523727

File tree

1 file changed

+2
-2
lines changed
  • components/network/ble/blemesh/src

1 file changed

+2
-2
lines changed

components/network/ble/blemesh/src/crypto.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ static int bt_mesh_ccm_decrypt(const u8_t key[16], u8_t nonce[13],
243243
}
244244

245245
/* If AAD is being used to authenticate, include it here */
246-
if (aad_len) {
246+
if (aad_len && aad) {
247247
sys_put_be16(aad_len, pmsg);
248248

249249
for (i = 0; i < sizeof(u16_t); i++) {
@@ -407,7 +407,7 @@ static int bt_mesh_ccm_encrypt(const u8_t key[16], u8_t nonce[13],
407407
}
408408

409409
/* If AAD is being used to authenticate, include it here */
410-
if (aad_len) {
410+
if (aad_len && aad) {
411411
sys_put_be16(aad_len, pmsg);
412412

413413
for (i = 0; i < sizeof(u16_t); i++) {

0 commit comments

Comments
 (0)