b1047b
diff --git a/epan/dissectors/packet-zbee-security.c b/epan/dissectors/packet-zbee-security.c
b1047b
index 14fdb0a..34bc1a8 100644
b1047b
--- a/epan/dissectors/packet-zbee-security.c
b1047b
+++ b/epan/dissectors/packet-zbee-security.c
b1047b
@@ -590,11 +590,9 @@ dissect_zbee_secure(tvbuff_t *tvb, packet_info *pinfo, proto_tree* tree, guint o
b1047b
     }
b1047b
 
b1047b
     /* Check for null payload. */
b1047b
-    if ( !(payload_len = tvb_reported_length_remaining(tvb, offset+mic_len)) ) {
b1047b
+    payload_len = tvb_captured_length_remaining(tvb, offset+mic_len);
b1047b
+    if (payload_len == 0)
b1047b
         return NULL;
b1047b
-    } else if ( payload_len < 0 ) {
b1047b
-        THROW(ReportedBoundsError);
b1047b
-    }
b1047b
 
b1047b
     /**********************************************
b1047b
      *  Perform Security Operations on the Frame  *
b1047b
@@ -606,10 +604,31 @@ dissect_zbee_secure(tvbuff_t *tvb, packet_info *pinfo, proto_tree* tree, guint o
b1047b
         (packet.level == ZBEE_SEC_MIC128)) {
b1047b
 
b1047b
         /* Payload is only integrity protected. Just return the sub-tvbuff. */
b1047b
-        return tvb_new_subset(tvb, offset, payload_len, payload_len);
b1047b
+        return tvb_new_subset_length(tvb, offset, payload_len);
b1047b
     }
b1047b
 
b1047b
 #ifdef HAVE_LIBGCRYPT
b1047b
+    /* Have we captured all the payload? */
b1047b
+    if (tvb_length_remaining(tvb, offset+mic_len) < payload_len) {
b1047b
+        /*
b1047b
+         * No - don't try to decrypt it.
b1047b
+         *
b1047b
+         * XXX - it looks as if the decryption code is assuming we have the
b1047b
+         * MIC, which won't be the case if the packet was cut short.  Is
b1047b
+         * that in fact that case, or can we still make this work with a
b1047b
+         * partially-captured packet?
b1047b
+         */
b1047b
+        /* Add expert info. */
b1047b
+        expert_add_info_format(pinfo, sec_tree, PI_UNDECODED, PI_WARN,
b1047b
+                "Encrypted payload, cut short when capturing - can't decrypt");
b1047b
+        /* Create a buffer for the undecrypted payload. */
b1047b
+        payload_tvb = tvb_new_subset_length(tvb, offset, payload_len);
b1047b
+        /* Dump the payload to the data dissector. */
b1047b
+        call_dissector(data_handle, payload_tvb, pinfo, tree);
b1047b
+        /* Couldn't decrypt, so return NULL. */
b1047b
+        return NULL;
b1047b
+    }
b1047b
+
b1047b
     /* Allocate memory to decrypt the payload into. */
b1047b
     dec_buffer = (guint8 *)g_malloc(payload_len);
b1047b