Skip to content

Commit

Permalink
mDNS: protect MDNSResponder::queryService against misuse (#7216)
Browse files Browse the repository at this point in the history
* mDNS: protect MDNSResponder::queryService against misuse

* fix style
  • Loading branch information
d-a-v committed Apr 15, 2020
1 parent e1789dd commit e5f4514
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libraries/ESP8266mDNS/src/LEAmDNS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,12 @@ uint32_t MDNSResponder::queryService(const char* p_pcService,
const char* p_pcProtocol,
const uint16_t p_u16Timeout /*= MDNS_QUERYSERVICES_WAIT_TIME*/)
{
if (0 == m_pUDPContext)
{
// safeguard against misuse
return 0;
}

DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] queryService '%s.%s'\n"), p_pcService, p_pcProtocol););

uint32_t u32Result = 0;
Expand Down

0 comments on commit e5f4514

Please sign in to comment.