diff --git a/nfq/protocol.c b/nfq/protocol.c index a211963..8c19f62 100644 --- a/nfq/protocol.c +++ b/nfq/protocol.c @@ -277,11 +277,11 @@ static bool TLSExtractHostFromExt(const uint8_t *ext, size_t elen, char *host, s // u16 data+0 - name list length // u8 data+2 - server name type. 0=host_name // u16 data+3 - server name length - if (elen < 5 || (ext && ext[2] != 0)) return false; + if (elen < 5 || ext[2] != 0) return false; size_t slen = pntoh16(ext + 3); ext += 5; elen -= 5; if (slen < elen) return false; - if (ext && len_host) + if (host && len_host) { if (slen >= len_host) slen = len_host - 1; for (size_t i = 0; i < slen; i++) host[i] = tolower(ext[i]); diff --git a/tpws/protocol.c b/tpws/protocol.c index 7d3fb1c..1facc59 100644 --- a/tpws/protocol.c +++ b/tpws/protocol.c @@ -267,11 +267,11 @@ static bool TLSExtractHostFromExt(const uint8_t *ext, size_t elen, char *host, s // u16 data+0 - name list length // u8 data+2 - server name type. 0=host_name // u16 data+3 - server name length - if (elen < 5 || (ext && ext[2] != 0)) return false; + if (elen < 5 || ext[2] != 0) return false; size_t slen = pntoh16(ext + 3); ext += 5; elen -= 5; if (slen < elen) return false; - if (ext && len_host) + if (host && len_host) { if (slen >= len_host) slen = len_host - 1; for (size_t i = 0; i < slen; i++) host[i] = tolower(ext[i]);