Enforce a length limit on an incoming path trace list.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2012-08-07 21:26:16 +02:00
parent edfb5fac84
commit f3f62318e2
1 changed files with 7 additions and 0 deletions

7
tlv.c
View File

@ -24,6 +24,7 @@ void tlv_post_recv(struct TLV *tlv)
{
struct management_tlv *mgt;
struct management_error_status *mes;
struct path_trace_tlv *ptt;
switch (tlv->type) {
case TLV_MANAGEMENT:
@ -40,7 +41,13 @@ void tlv_post_recv(struct TLV *tlv)
case TLV_GRANT_UNICAST_TRANSMISSION:
case TLV_CANCEL_UNICAST_TRANSMISSION:
case TLV_ACKNOWLEDGE_CANCEL_UNICAST_TRANSMISSION:
break;
case TLV_PATH_TRACE:
ptt = (struct path_trace_tlv *) tlv;
if (path_length(ptt) > PATH_TRACE_MAX) {
ptt->length = PATH_TRACE_MAX * sizeof(struct ClockIdentity);
}
break;
case TLV_ALTERNATE_TIME_OFFSET_INDICATOR:
case TLV_AUTHENTICATION:
case TLV_AUTHENTICATION_CHALLENGE: