aboutsummaryrefslogtreecommitdiffstats
path: root/epan/crypt
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2017-12-23 21:52:20 +0100
committerAnders Broman <a.broman58@gmail.com>2017-12-24 06:39:38 +0000
commite30374d1691c5728cc979e9682ad4e99ea5c8252 (patch)
tree5dedefd0dd7e48fabcfa72e4cd7d3e5e738b521c /epan/crypt
parentc2dee336304a0bfb4e53ec3786c637b5c96903ba (diff)
airpdcap: check return value for gcry_mac_read (CID: 1420699).
Change-Id: Ifdf044d99e912ac90044aca7be503fdf39b4fe74 Reviewed-on: https://code.wireshark.org/review/24967 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/crypt')
-rw-r--r--epan/crypt/airpdcap.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/epan/crypt/airpdcap.c b/epan/crypt/airpdcap.c
index 577b1a3bd4..5d86631625 100644
--- a/epan/crypt/airpdcap.c
+++ b/epan/crypt/airpdcap.c
@@ -2264,7 +2264,11 @@ AirPDcapTDLSDeriveKey(
gcry_mac_write(cmac_handle, &data[offset_fte], 4);
gcry_mac_write(cmac_handle, zeros, 16);
gcry_mac_write(cmac_handle, &data[offset_fte + 20], data[offset_fte + 1] + 2 - 20);
- gcry_mac_read(cmac_handle, mic, &cmac_len);
+ if (gcry_mac_read(cmac_handle, mic, &cmac_len) != GPG_ERR_NO_ERROR) {
+ AIRPDCAP_DEBUG_PRINT_LINE("AirPDcapTDLSDeriveKey", "MAC read error", AIRPDCAP_DEBUG_LEVEL_3);
+ gcry_mac_close(cmac_handle);
+ return AIRPDCAP_RET_UNSUCCESS;
+ }
if (memcmp(mic, &data[offset_fte + 4], 16)) {
AIRPDCAP_DEBUG_PRINT_LINE("AirPDcapTDLSDeriveKey", "MIC verification failed", AIRPDCAP_DEBUG_LEVEL_3);
gcry_mac_close(cmac_handle);