Ancestors

Written by reynir on 2024-12-05 at 15:38

Option parsing in dnsmasq is some pretty bonkers code. I might write something about it later.

=> More informations about this toot | More toots from reynir@bsd.network

Written by reynir on 2024-12-05 at 15:51

Great, I think I found an unsafe bug already. In its "hex" parser code.

=> More informations about this toot | More toots from reynir@bsd.network

Written by reynir on 2024-12-05 at 16:05

The following two produce a dhcp-host rule with the same dhcp client identifier. In dnsmasq a client identifier with a colon is interpreted as hex:

$ dnsmasq --test --dhcp-host id:ABCD4344

As you can maybe tell the hex parser starts parsing the already decoded data as hex (43 and 44).

(yes, you're allowed to put as many colons in your "hex". And you can put a * in there as well as long as it's not adjacent to a real hexadecimal digit. Dnsmasq's parse_hex() has a really weird concept of hex)

=> More informations about this toot | More toots from reynir@bsd.network

Written by reynir on 2024-12-05 at 16:11

Sorry, I think the explanation is wrong, but clearly something fishy is going on. 0x41, 0x42, 0x43, 0x44 is ascii for ABCD which is fine, and then the parser hits :::: and does something really wrong.

A lot of the parser code mutates the input string and parse_hex() is no exception. It's really hard to get a good understanding of what goes on.

=> More informations about this toot | More toots from reynir@bsd.network

Written by reynir on 2024-12-05 at 16:16

Here are some other interesting "equalities":

=> More informations about this toot | More toots from reynir@bsd.network

Written by reynir on 2024-12-05 at 16:18

(oh yea I forgot to mention that the totally normal parse_hex() also accepts dashes! They are usually ignored unless parse_hex() has a non-null mac_type output argument)

=> More informations about this toot | More toots from reynir@bsd.network

Toot

Written by reynir on 2024-12-05 at 16:34

So parse_hex() is also used to parse mac addresses. You might see a mac address 1-00:11:22:33:44:55 which says it's hardware type 1 (ethernet (10 Mb)) and mac address 00:11:22:33:44:55.

Interestinly, this means this emoticon my spouse and I sometimes send to each other is also a mac address: :-*

It's the one byte mac address of any value (with an unspecified hardware type, I think). The * for mac addresses is a one byte mask.

=> More informations about this toot | More toots from reynir@bsd.network

Descendants

Proxy Information
Original URL
gemini://mastogem.picasoft.net/thread/113601183629078360
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
262.280739 milliseconds
Gemini-to-HTML Time
2.468391 milliseconds

This content has been proxied by September (3851b).