summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2013-06-14 14:31:08 +0200
committerTobias Klauser <tklauser@distanz.ch>2013-06-14 14:31:08 +0200
commit8cb741a7dce0bcc9140a1f717028a8b4c80559f5 (patch)
treee8ee81e9724fdfecd7eb60e720ad5b8d2c45e09f
parent50743a7fed464958aba9f729324e35a4f0c945a3 (diff)
dissector: icmpv6: Fix yet another possible null pointer dereference
THe Coverity scanner discovered yet another possible null pointer dereference. Fix it by checking the return value of pkt_pull(). Also remove some trailing whitespaces in the region. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
-rw-r--r--proto_icmpv6.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/proto_icmpv6.c b/proto_icmpv6.c
index 35ed1ae..77c89b1 100644
--- a/proto_icmpv6.c
+++ b/proto_icmpv6.c
@@ -550,13 +550,21 @@ static int8_t dissect_neighb_disc_ops_15(struct pkt_buff *pkt,
tprintf("Pad Len (%zu) ", pad_len);
name_len = len - pad_len;
-
+
tprintf("Name (");
while (name_len--) {
- tprintf("%c", *pkt_pull(pkt,1));
+ uint8_t *data = pkt_pull(pkt, 1);
+
+ if (data == NULL) {
+ tprintf("%sINVALID%s", colorize_start_full(black, red),
+ colorize_end());
+ return 0;
+ }
+
+ tprintf("%c", *data);
}
tprintf(") ");
-
+
tprintf("Padding (");
while (pad_len--) {