AvahiClient - Fix parsing of TXT records if value contains '='

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.
This commit is contained in:
Jonathan Bagg
2022-02-17 20:41:07 -05:00
parent 01f35f27a3
commit 334ca21012

View File

@ -153,11 +153,11 @@ public:
while (txt) // get txt records
{
QByteArray avahiText((const char *)txt->text, txt->size);
QList<QByteArray> pair = avahiText.split('=');
if (pair.size() == 2)
zcs->m_txt[pair.at(0)] = pair.at(1);
const ssize_t pos = avahiText.indexOf('=');
if (pos < 0)
zcs->m_txt[avahiText] = "";
else
zcs->m_txt[pair.at(0)] = "";
zcs->m_txt[avahiText.left(pos)] = avahiText.mid(pos + 1, -1);
txt = txt->next;
}
ref->pub->services.insert(key, zcs);