mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 21:05:08 +00:00
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 in20b4130314
. Bring it back. Reported by: Coverity Scan, cy Reviewed by: cy CID: 1506960 (UNINIT) Fixes:20b4130314
MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D39233
This commit is contained in:
parent
2084f6a496
commit
4630a3252a
|
@ -1156,6 +1156,7 @@ pr_pack(char *buf, ssize_t cc, struct sockaddr_in *from, struct timespec *tv)
|
||||||
struct ip oip;
|
struct ip oip;
|
||||||
u_char oip_header_len;
|
u_char oip_header_len;
|
||||||
struct icmp oicmp;
|
struct icmp oicmp;
|
||||||
|
const u_char *oicmp_raw;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get size of IP header of the received packet.
|
* 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));
|
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) ||
|
if (((options & F_VERBOSE) && uid == 0) ||
|
||||||
(!(options & F_QUIET2) &&
|
(!(options & F_QUIET2) &&
|
||||||
|
|
Loading…
Reference in a new issue