meta: fix error checks in tc handle parser
Florian Westphal
maintainerPATCH 1/1 meta: fix error checks in tc handle parser
'meta priority foobar' did not return an error -- instead we used min/max values with undefined content.
--- src/meta.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
src/meta.c +3 -3
@@ -100,17 +100,17 @@ static struct error_record *tchandle_type_parse(const struct expr *sym,else if (strcmp (sym->identifier,"none" ) ==0 ) handle =TC_H_UNSPEC ;else if (sym->identifier[0 ] ==':' ) { -if (sscanf (sym->identifier,":%04x" , &handle) <0 ) +if (sscanf (sym->identifier,":%04x" , &handle) !=1 ) goto err; }else if (sym->identifier[strlen (sym->identifier)-1 ] ==':' ) { -if (sscanf (sym->identifier,"%04x:" , &handle) <0 ) +if (sscanf (sym->identifier,"%04x:" , &handle) !=1 ) goto err; handle <<=16 ; }else {uint32_t min, max; -if (sscanf (sym->identifier,"%04x:%04x" , &min, &max) <0 ) +if (sscanf (sym->identifier,"%04x:%04x" , &min, &max) !=2 ) goto err; handle = max <<16 | min;
Signature · 1 line
2.4.10
Pablo Neira Ayuso
maintainerQuoted 4 lines · Florian Westphal
'meta priority foobar' did not return an error -- instead we used min/max values with undefined content.
Signed-off-by Florian Westphal <[email protected]>
Fine with me. IIRC, the scanner is still broken though.
Florian Westphal
maintainerQuoted 7 lines · Pablo Neira Ayuso
Quoted 4 lines · Florian Westphal
'meta priority foobar' did not return an error -- instead we used min/max values with undefined content.
Signed-off-by Florian Westphal <[email protected]>Fine with me. IIRC, the scanner is still broken though.
Ho-hum. It is. And I don't see how this can be fixed. Teaching scanner.l about
tchandle {hexdigit}{4}:{hexdigit}{4}
breaks
tcp sport vmap { 1225:accept, }
( 1225:acc is handle).
Quoted 4 lines · Florian Westphal
'meta priority foobar' did not return an error -- instead we used min/max values with undefined content.
Signed-off-by Florian Westphal <[email protected]>
I know this is still not the full fix for this, but I would like to make sure this doesn't get lost, so go push it. Thanks.