Attention is currently required from: pespin.
2 comments:
File src/mslookup/mdns_rfc.c:
Patch Set #1, Line 80: if (osmo_apn_from_str(buf, buf_len, qst->domain) < 0)
so in here you are assuming that encoding the string into the msg will take always exactly strlen(qs […]
Yes. Each part of the domain is encoded with a label that consists of the size and the string. There's always one more label length than the amount of dots. For example:
"osmocom.org" -> len 11
0x07, 'o', 's', 'm', 'o', 'c', 'o', 'm', 0x03, 'o', 'r', 'g' -> len 12
Patch Set #1, Line 105: ret->domain = talloc_size(ret, qname_len - 1);
I'd expect the string to be longer than the buffer due to \0? Is this correct?
qname_len is the size of the encoded domain name + 0x00 at the end, e.g.
0x07, 'o', 's', 'm', 'o', 'c', 'o', 'm', 0x03, 'o', 'r', 'g', 0x00 -> len 13
Therefore "osmocom.org" with 0x00 at the end needs one char less, so it's correct as written there.
To view, visit change 30777. To unsubscribe, or for help writing mail filters, visit settings.