openwrt/package/system/procd/files
Christian Marangi 4b04304713
procd: make mDNS TXT record parsing more solid
mDNS broadcast can't accept empty TXT record and would fail
registration.

Current procd_add_mdns_service checks only if the first passed arg is
empty but don't make any verification on the other args permittins
insertion of empty values in TXT record.

Example:

	procd_add_mdns "blah" \
				"tcp" "50" \
				"1" \
				"" \
				"3"

Produce:

{ "blah_50": { "service": "_blah._tcp.local", "port": 50, "txt": [ "1", "", "3" ] } }

The middle empty TXT record should never be included as it's empty.

This can happen with scripts that make fragile parsing and include
variables even if they are empty.

Prevent this and make the TXT record more solid by checking every
provided TXT record and include only the non-empty ones.

The fixed JSON is the following:

{ "blah_50": { "service": "_blah._tcp.local", "port": 50, "txt": [ "1", "3" ] } }

Fixes: b0d9dcf84dd0 ("procd: update to latest git HEAD")
Reported-by: Paul Donald <newtwen@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/15331
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-04-29 23:24:58 +02:00
..
hotplug-preinit.json procd: fix hotplug-preinit.json syntax 2017-08-18 18:43:54 +02:00
hotplug.json procd: create /dev/fd symlink 2023-09-16 20:48:34 +02:00
procd.sh procd: make mDNS TXT record parsing more solid 2024-04-29 23:24:58 +02:00
reload_config procd: replace backticks by $(...) 2020-05-13 19:01:23 +02:00
service procd: service: pass all arguments to service 2022-11-13 21:51:10 +01:00
uxc.init procd: simplify uxc init script 2022-02-13 23:31:27 +00:00