Commit 4b45abd1 authored by Stephen Hemminger's avatar Stephen Hemminger

Fix NULL pointer reference when using basic match

If basic match has no tree of matches underneath
then print_ematch would core dump.
parent 4dbda0f4
...@@ -449,12 +449,14 @@ static int print_ematch_list(FILE *fd, struct tcf_ematch_tree_hdr *hdr, ...@@ -449,12 +449,14 @@ static int print_ematch_list(FILE *fd, struct tcf_ematch_tree_hdr *hdr,
if (tb == NULL) if (tb == NULL)
return -1; return -1;
if (parse_rtattr_nested(tb, hdr->nmatches, rta) < 0) if (hdr->nmatches > 0) {
goto errout; if (parse_rtattr_nested(tb, hdr->nmatches, rta) < 0)
goto errout;
fprintf(fd, "\n "); fprintf(fd, "\n ");
if (print_ematch_seq(fd, tb, 1, 1) < 0) if (print_ematch_seq(fd, tb, 1, 1) < 0)
goto errout; goto errout;
}
err = 0; err = 0;
errout: errout:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment