Skip to content

Commit e5f4514

Browse files
authored
mDNS: protect MDNSResponder::queryService against misuse (#7216)
* mDNS: protect MDNSResponder::queryService against misuse * fix style
1 parent e1789dd commit e5f4514

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

libraries/ESP8266mDNS/src/LEAmDNS.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,12 @@ uint32_t MDNSResponder::queryService(const char* p_pcService,
767767
const char* p_pcProtocol,
768768
const uint16_t p_u16Timeout /*= MDNS_QUERYSERVICES_WAIT_TIME*/)
769769
{
770+
if (0 == m_pUDPContext)
771+
{
772+
// safeguard against misuse
773+
return 0;
774+
}
775+
770776
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] queryService '%s.%s'\n"), p_pcService, p_pcProtocol););
771777

772778
uint32_t u32Result = 0;

0 commit comments

Comments
 (0)