mirror of
https://github.com/bol-van/zapret.git
synced 2024-11-26 12:10:53 +03:00
cppcheck: fix possible null pointer dereference
[nfq/desync.c:1242] -> [nfq/desync.c:1243]: (warning) Either the condition 'if(ip6hdr)' is redundant or there is possible null pointer dereference: ip6hdr. [nfq/protocol.c:280] -> [nfq/protocol.c:284]: (warning) Either the condition 'if(ext&&len_host)' is redundant or there is possible null pointer dereference: ext. [tpws/protocol.c:270] -> [tpws/protocol.c:274]: (warning) Either the condition 'if(ext&&len_host)' is redundant or there is possible null pointer dereference: ext.
This commit is contained in:
parent
6fca1223b3
commit
9574539292
11
nfq/desync.c
11
nfq/desync.c
@ -1236,9 +1236,14 @@ static uint8_t dpi_desync_udp_packet_play(bool replay, size_t reasm_offset, uint
|
|||||||
if (!replay && !process_desync_interval(ctrack)) return verdict;
|
if (!replay && !process_desync_interval(ctrack)) return verdict;
|
||||||
|
|
||||||
uint32_t desync_fwmark = fwmark | params.desync_fwmark;
|
uint32_t desync_fwmark = fwmark | params.desync_fwmark;
|
||||||
ttl_orig = ip ? ip->ip_ttl : ip6hdr->ip6_ctlun.ip6_un1.ip6_un1_hlim;
|
|
||||||
if (ip6hdr) ttl_fake = params.desync_ttl6 ? params.desync_ttl6 : ttl_orig;
|
if (ip6hdr) {
|
||||||
else ttl_fake = params.desync_ttl ? params.desync_ttl : ttl_orig;
|
ttl_orig = ip ? ip->ip_ttl : ip6hdr->ip6_ctlun.ip6_un1.ip6_un1_hlim;
|
||||||
|
ttl_fake = params.desync_ttl6 ? params.desync_ttl6 : ttl_orig;
|
||||||
|
} else {
|
||||||
|
ttl_orig = ip ? ip->ip_ttl : 0;
|
||||||
|
ttl_fake = params.desync_ttl ? params.desync_ttl : ttl_orig;
|
||||||
|
}
|
||||||
extract_endpoints(ip, ip6hdr, NULL, udphdr, &src, &dst);
|
extract_endpoints(ip, ip6hdr, NULL, udphdr, &src, &dst);
|
||||||
|
|
||||||
if (len_payload)
|
if (len_payload)
|
||||||
|
@ -277,7 +277,7 @@ static bool TLSExtractHostFromExt(const uint8_t *ext, size_t elen, char *host, s
|
|||||||
// u16 data+0 - name list length
|
// u16 data+0 - name list length
|
||||||
// u8 data+2 - server name type. 0=host_name
|
// u8 data+2 - server name type. 0=host_name
|
||||||
// u16 data+3 - server name length
|
// u16 data+3 - server name length
|
||||||
if (elen < 5 || ext[2] != 0) return false;
|
if (elen < 5 || (ext && ext[2] != 0)) return false;
|
||||||
size_t slen = pntoh16(ext + 3);
|
size_t slen = pntoh16(ext + 3);
|
||||||
ext += 5; elen -= 5;
|
ext += 5; elen -= 5;
|
||||||
if (slen < elen) return false;
|
if (slen < elen) return false;
|
||||||
|
@ -267,7 +267,7 @@ static bool TLSExtractHostFromExt(const uint8_t *ext, size_t elen, char *host, s
|
|||||||
// u16 data+0 - name list length
|
// u16 data+0 - name list length
|
||||||
// u8 data+2 - server name type. 0=host_name
|
// u8 data+2 - server name type. 0=host_name
|
||||||
// u16 data+3 - server name length
|
// u16 data+3 - server name length
|
||||||
if (elen < 5 || ext[2] != 0) return false;
|
if (elen < 5 || (ext && ext[2] != 0)) return false;
|
||||||
size_t slen = pntoh16(ext + 3);
|
size_t slen = pntoh16(ext + 3);
|
||||||
ext += 5; elen -= 5;
|
ext += 5; elen -= 5;
|
||||||
if (slen < elen) return false;
|
if (slen < elen) return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user