fw4: gracefully handle `null` return values from `fd.read("line")`
authorJo-Philipp Wich <jo@mein.io>
Tue, 18 Oct 2022 07:20:56 +0000 (09:20 +0200)
committerJo-Philipp Wich <jo@mein.io>
Tue, 18 Oct 2022 07:20:56 +0000 (09:20 +0200)
commit7ae5e14bbd7265cc67ec870c3bb0c8e197bb7ca9
tree104212b10e093e0d005412fce3b42f1d3c912b94
parent4fbf6d75a4a9e523d1848a28d8a3ea095e870195
fw4: gracefully handle `null` return values from `fd.read("line")`

Since ucode commit 4ae7072 "fs: use `getline()` for line wise read operations"
a call to `fs.read("line")` will yield `null` instead of an empty string when
encountering EOF, leading to an infinite loop when parsing loadfile entries.

Solve this issue by checking both for `null` and empty string return values.

Ref: https://forum.openwrt.org/t/x/139951/12
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
root/usr/share/ucode/fw4.uc