diff options
author | Jose Luis Duran <jlduran@gmail.com> | 2023-03-24 04:53:54 +0000 |
---|---|---|
committer | Cy Schubert <cy@FreeBSD.org> | 2023-03-24 04:58:28 +0000 |
commit | 4630a3252ac8ad2f5acddf0d1efb26795cb3190b (patch) | |
tree | c78a72f7a597ebebbc65b81c392ed03ff717f8d4 | |
parent | 2084f6a496cefb5da9dbdabad5aa99342e2fc163 (diff) | |
download | src-4630a3252ac8ad2f5acddf0d1efb26795cb3190b.tar.gz src-4630a3252ac8ad2f5acddf0d1efb26795cb3190b.zip |
ping: Fix an uninitialized variable
The variable oicmp, which holds the original ("quoted packet") ICMP
packet in a structured way, did not have a copy of the original ICMP
packet obtained from the raw data.
The code was accidentally removed in 20b41303140e. Bring it back.
Reported by: Coverity Scan, cy
Reviewed by: cy
CID: 1506960 (UNINIT)
Fixes: 20b41303140eee4dfb896558fb83600c5f013d39
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39233
-rw-r--r-- | sbin/ping/ping.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c index 6b82fe3da9de..965b565da7b9 100644 --- a/sbin/ping/ping.c +++ b/sbin/ping/ping.c @@ -1156,6 +1156,7 @@ pr_pack(char *buf, ssize_t cc, struct sockaddr_in *from, struct timespec *tv) struct ip oip; u_char oip_header_len; struct icmp oicmp; + const u_char *oicmp_raw; /* * Get size of IP header of the received packet. @@ -1359,6 +1360,8 @@ pr_pack(char *buf, ssize_t cc, struct sockaddr_in *from, struct timespec *tv) } memcpy(&oip, icmp_data_raw, sizeof(struct ip)); + oicmp_raw = icmp_data_raw + oip_header_len; + memcpy(&oicmp, oicmp_raw, sizeof(struct icmp)); if (((options & F_VERBOSE) && uid == 0) || (!(options & F_QUIET2) && |