pmc: goto out when get unknown management tlv

If handle unknown management tlv. The management message id and format are
also unknown, thus we may crash due to access unknown area.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
master
Hangbin Liu 2017-05-23 14:49:55 +08:00 committed by Richard Cochran
parent a216b11ce5
commit 95b5a13cb2
1 changed files with 1 additions and 0 deletions

1
pmc.c
View File

@ -217,6 +217,7 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
goto out; goto out;
} else { } else {
fprintf(fp, "unknown-tlv "); fprintf(fp, "unknown-tlv ");
goto out;
} }
mgt = (struct management_tlv *) msg->management.suffix; mgt = (struct management_tlv *) msg->management.suffix;
if (mgt->length == 2 && mgt->id != TLV_NULL_MANAGEMENT) { if (mgt->length == 2 && mgt->id != TLV_NULL_MANAGEMENT) {