ISAKMP: fix Argument with 'nonnull' attribute passed null found by Clang Analyzer
authorAlexis La Goutte <alexis.lagoutte@gmail.com>
Sun, 21 Aug 2016 14:50:15 +0000 (16:50 +0200)
committerMichael Mann <mmann78@netscape.net>
Fri, 23 Sep 2016 03:00:27 +0000 (03:00 +0000)
Change-Id: I8d7ebc6dd46e0d6494d412653ec423b8c0fde9c8
Reviewed-on: https://code.wireshark.org/review/17203
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
epan/dissectors/packet-isakmp.c

index 91e0f4b16901d573d4ec88a195a63b974b1c219a..0750a4210cfe34d28cef7779d99ab3c3177f53f0 100644 (file)
@@ -5323,7 +5323,9 @@ dissect_enc(tvbuff_t *tvb,
 
         encr_iv = (guchar *)wmem_alloc0(wmem_packet_scope(), encr_iv_len);
         memcpy( encr_iv + encr_iv_offset, key_info->encr_key + encr_key_len, key_info->encr_spec->salt_len );
-        memcpy( encr_iv + encr_iv_offset + key_info->encr_spec->salt_len, iv, iv_len );
+        if(iv) {
+          memcpy( encr_iv + encr_iv_offset + key_info->encr_spec->salt_len, iv, iv_len );
+        }
         if (key_info->encr_spec->gcry_mode == GCRY_CIPHER_MODE_CTR) {
           encr_iv[encr_iv_len-1] = 1;
           /* fallback for gcrypt not having AEAD ciphers */