Skip to content

mdns crash due to not check empty proto, service (IDFGH-6675) #8307

Closed
@chegewara

Description

@chegewara

Hi, im not sure if its due to my badly initialized mdns, but i believe it should be "fixed" anyway, sometimes we can receive requests with only instance, and having service and proto empty:

instance: test
instance: test
instance: test
instance: test
GET / HTTP/1.1
User-Agent: Dalvik/2.1.0 (Linux; U; Android 11; SM-A725F Build/RP1A.200720.012)
Host: 192.168.0.113:50000
Connection: Keep-Alive
Accept-Encoding: gzip

instance: softap-8AE4
service: _telnet
proto: _tcp

This is causing crash here:
https://github.com/espressif/esp-idf/blob/master/components/mdns/mdns.c#L287-L288

I dont know if it is good solution, as i am fairly new to mdns, but this works to me:

    return (_str_null_or_empty(service) || !strcasecmp(srv->service, service)) && 
            (_str_null_or_empty(instance) || _mdns_instance_name_match(srv->instance, instance)) &&
            (_str_null_or_empty(proto) || !strcasecmp(srv->proto, proto)) && 
            (_str_null_or_empty(hostname) || !strcasecmp(srv->hostname, hostname));

Long story short, i am trying to add mdns to product with TCP/UDP server.
Testing with Service browser app on android.
esp-idf 309c111

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions