From 851909d2c8e54ba8d087d68cc977a90bea4e0fd0 Mon Sep 17 00:00:00 2001 From: Pascal Quantin Date: Sat, 20 Dec 2014 18:39:51 +0100 Subject: [PATCH] FCoIB / Infiniband SDP: prevent a crash when 'enable manual settings' is set without filling address field Bug: 10796 Change-Id: Ifdb7804ec5e1146b08f00e54647d802a69d52113 Reviewed-on: https://code.wireshark.org/review/5914 Tested-by: Pascal Quantin Petri-Dish: Pascal Quantin Tested-by: Petri Dish Buildbot Reviewed-by: Pascal Quantin --- epan/dissectors/packet-fcoib.c | 4 +++- epan/dissectors/packet-infiniband_sdp.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/epan/dissectors/packet-fcoib.c b/epan/dissectors/packet-fcoib.c index c30d190cc7..3c0b4f029c 100644 --- a/epan/dissectors/packet-fcoib.c +++ b/epan/dissectors/packet-fcoib.c @@ -431,7 +431,9 @@ proto_reg_handoff_fcoib(void) int i; for (i = 0; i < 2; i++) { - if (gPREF_TYPE[i] == 0) { /* LID */ + if (gPREF_ID[i][0] == '\0') { + error_occured = TRUE; + } else if (gPREF_TYPE[i] == 0) { /* LID */ errno = 0; /* reset any previous error indicators */ *((guint16*)manual_addr_data[i]) = (guint16)strtoul(gPREF_ID[i], ¬_parsed, 0); if (errno || *not_parsed != '\0') { diff --git a/epan/dissectors/packet-infiniband_sdp.c b/epan/dissectors/packet-infiniband_sdp.c index 9121294047..f847102db4 100644 --- a/epan/dissectors/packet-infiniband_sdp.c +++ b/epan/dissectors/packet-infiniband_sdp.c @@ -532,7 +532,9 @@ proto_reg_handoff_ib_sdp(void) int i; for (i = 0; i < 2; i++) { - if (gPREF_TYPE[i] == 0) { /* LID */ + if (gPREF_ID[i][0] == '\0') { + error_occured = TRUE; + } else if (gPREF_TYPE[i] == 0) { /* LID */ errno = 0; /* reset any previous error indicators */ *((guint16*)manual_addr_data[i]) = (guint16)strtoul(gPREF_ID[i], ¬_parsed, 0); if (errno || *not_parsed != '\0') {