🔧 build(enable cppcheck on build): eliminate cppcheck error
This commit is contained in:
@@ -253,7 +253,7 @@ static inline void ip4_hdr_set_opt_len(struct ip *hdr, uint8_t opt_len)
|
||||
// must be called after ip4_hdr_set_opt_len
|
||||
static inline void ip4_hdr_set_opt_data(struct ip *hdr, const char *opt_data)
|
||||
{
|
||||
memcpy((char *)hdr + sizeof(struct ip), opt_data, ip4_hdr_get_opt_len(hdr));
|
||||
if(opt_data)memcpy((char *)hdr + sizeof(struct ip), opt_data, ip4_hdr_get_opt_len(hdr));
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
||||
@@ -722,11 +722,11 @@ static inline const char *parse_udp(struct packet *pkt, const char *data, uint16
|
||||
{
|
||||
return data;
|
||||
}
|
||||
const struct udphdr *hdr = (struct udphdr *)data;
|
||||
const struct udphdr *udp_hdr = (struct udphdr *)data;
|
||||
SET_LAYER(pkt, layer, LAYER_PROTO_UDP, sizeof(struct udphdr), data, len, 0);
|
||||
|
||||
uint16_t src_port = udp_hdr_get_src_port(hdr);
|
||||
uint16_t dst_port = udp_hdr_get_dst_port(hdr);
|
||||
uint16_t src_port = udp_hdr_get_src_port(udp_hdr);
|
||||
uint16_t dst_port = udp_hdr_get_dst_port(udp_hdr);
|
||||
|
||||
if (dst_port == 4789)
|
||||
{
|
||||
@@ -772,8 +772,8 @@ static inline const char *parse_udp(struct packet *pkt, const char *data, uint16
|
||||
{
|
||||
return layer->pld_ptr;
|
||||
}
|
||||
const struct ip6_hdr *hdr = (const struct ip6_hdr *)layer->pld_ptr;
|
||||
if (ip6_hdr_get_version(hdr) != 6)
|
||||
const struct ip6_hdr *ipv6_hdr = (const struct ip6_hdr *)layer->pld_ptr;
|
||||
if (ip6_hdr_get_version(ipv6_hdr) != 6)
|
||||
{
|
||||
return layer->pld_ptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user