Hi,
I've found a bug on wap/wtls_pdu.c file, wtls_payload_dump function.
This function may be called with an NULL payload (when wtls_decrypt outputs the error: ERROR: wtls_decrypt: Rejected packet due to bad MAC) which causes a segmentation fault.

I've attached the patch with the fix for the current trunk version.

Best regards,
Armindo Antunes



Index: wap/wtls_pdu.c
===================================================================
--- wap/wtls_pdu.c      (revision 4951)
+++ wap/wtls_pdu.c      (working copy)
@@ -1121,12 +1121,12 @@
 
 void wtls_payload_dump(wtls_Payload * payload, int level)
 {
-   char *dbg = "wap.wtls", type[20], *data =
-       octstr_get_cstr(payload->data);
+   char *dbg = "wap.wtls", type[20], *data;
+   if (!payload)
+      return;
+   data = octstr_get_cstr(payload->data);
 
        /* the message type */
-   if (!payload)
-      return;
    pduName(type, payload->type);
    debug(dbg, 0, "%*sPayload type: %s", level, "", type);
    if (payload->type == Handshake_PDU) {

Reply via email to