jbagg / QtZeroConf

Qt wrapper class for ZeroConf libraries across various platforms.
Other
69 stars 51 forks source link

Fix parsing of TXT records if value contains '=' #49

Closed FMeinicke closed 2 years ago

FMeinicke commented 2 years ago

TXT record values can also contain equals signs. The current implementation would consider any record where the value contains an equals sign as an empty record.

jbagg commented 2 years ago

It appears this issue exists for avahi core and avahi client implementations as well. What do you think of doing something like this instead? I think is it less cutting and joining....

while (txt)     // get txt records
{
    QByteArray avahiText((const char *)txt->text, txt->size);
    ssize_t pos = avahiText.indexOf('=');
    if (pos < 0)
        zcs->m_txt[avahiText] = "";
    else
        zcs->m_txt[avahiText.left(pos)] = avahiText.mid(pos + 1, -1);
    txt = txt->next;
}
ref->pub->services.insert(key, zcs);
FMeinicke commented 2 years ago

Sure, that works for me as well. I'm going to change the bonjour implementation and also fix the avahi core implementation.

jbagg commented 2 years ago

Merged this request locally. Closing.