From 7cefcf2bdea30db231ae9508638aeda10640ac2f Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Fri, 3 Apr 2009 15:54:16 +0200 Subject: [PATCH] src/liboping.c: Check if pointer is NULL before dereferencing it in `ping_receive_ipv4'. Thanks to Tomasz Pala for pointing out the problem. --- src/liboping.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/liboping.c b/src/liboping.c index 579aba3..0cff9f4 100644 --- a/src/liboping.c +++ b/src/liboping.c @@ -342,8 +342,9 @@ static pinghost_t *ping_receive_ipv4 (pinghost_t *ph, char *buffer, size_t buffe dprintf ("No match found for ident = 0x%04x, seq = %i\n", ident, seq); } - - ptr->recv_ttl = ip_hdr->ip_ttl; + + if (ptr != NULL) + ptr->recv_ttl = ip_hdr->ip_ttl; return (ptr); } -- 2.11.0