fw-addr-lists: check last character of line for JSON

This is not a proof, but a line also ending with a curly bracket
has higher probability of being valid JSON.

Better safe than sorry... We are suffering a CVE in RouterOS:
https://www.cve.org/CVERecord?id=CVE-2025-10948
This commit is contained in:
Christian Hesse 2025-10-02 11:51:08 +02:00
parent a931cb61a0
commit 48d0f1f0b9

View file

@ -103,7 +103,7 @@
:foreach Line in=[ :deserialize $Data delimiter="\n" from=dsv options=dsv.plain ] do={ :foreach Line in=[ :deserialize $Data delimiter="\n" from=dsv options=dsv.plain ] do={
:set Line ($Line->0); :set Line ($Line->0);
:local Address; :local Address;
:if ([ :pick $Line 0 1 ] = "{") do={ :if ([ :pick $Line 0 1 ] = "{" && [ :pick $Line ([ :len $Line ] - 1) ] = "}") do={
:do { :do {
:set Address [ :tostr ([ :deserialize from=json $Line ]->"cidr") ]; :set Address [ :tostr ([ :deserialize from=json $Line ]->"cidr") ];
} on-error={ } } on-error={ }