Skip to content

Commit 8f10a6e

Browse files
Fixed tlv length check. (ARMmbed#1992)
1 parent 1ef8dd6 commit 8f10a6e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

source/6LoWPAN/Thread/thread_joiner_application.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,12 +399,12 @@ static int link_configuration_update(link_configuration_s *link_configuration, u
399399
if (thread_meshcop_tlv_find(msg_ptr, msg_len, MESHCOP_TLV_PSKC, &ptr) >= 16) {
400400
memcpy(link_configuration->PSKc, ptr, 16);
401401
}
402-
403-
if (thread_meshcop_tlv_find(msg_ptr, msg_len, MESHCOP_TLV_SECURITY_POLICY, &ptr) >= 3) {
402+
uint16_t tlv_len = thread_meshcop_tlv_find(msg_ptr, msg_len, MESHCOP_TLV_SECURITY_POLICY, &ptr);
403+
if (tlv_len >= 3) {
404404
link_configuration->securityPolicyExt = SECURITY_POLICY_ALL_SECURITY;
405405
link_configuration->securityPolicy = ptr[2];
406406
link_configuration->key_rotation = common_read_16_bit(ptr);
407-
if (msg_len > 3) {
407+
if (tlv_len > 3) {
408408
link_configuration->securityPolicyExt = ptr[3];
409409
}
410410
}

0 commit comments

Comments
 (0)