From 5a2f60caffff4414360e1e0d816cf247df89fd00 Mon Sep 17 00:00:00 2001 From: Divya Sampath Kumar Date: Tue, 17 Aug 2021 16:46:41 -0700 Subject: [PATCH] Address comments --- src/source/Ice/IceAgent.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/source/Ice/IceAgent.c b/src/source/Ice/IceAgent.c index 70b4cc1ece..0408388e03 100644 --- a/src/source/Ice/IceAgent.c +++ b/src/source/Ice/IceAgent.c @@ -327,7 +327,7 @@ STATUS iceAgentAddRemoteCandidate(PIceAgent pIceAgent, PCHAR pIceCandidateString PDoubleListNode pCurNode = NULL; SDP_ICE_CANDIDATE_PARSER_STATE state; ICE_CANDIDATE_TYPE iceCandidateType = ICE_CANDIDATE_TYPE_HOST; - CHAR remoteProtocol[MAX_PROTOCOL_LENGTH]; + CHAR remoteProtocol[MAX_PROTOCOL_LENGTH] = {'\0'}; CHK(pIceAgent != NULL && pIceCandidateString != NULL, STATUS_NULL_ARG); CHK(!IS_EMPTY_STRING(pIceCandidateString), STATUS_INVALID_ARG); @@ -355,7 +355,9 @@ STATUS iceAgentAddRemoteCandidate(PIceAgent pIceAgent, PCHAR pIceCandidateString STRTOUI32(curr, next, 10, &priority); break; case SDP_ICE_CANDIDATE_PARSER_STATE_PROTOCOL: - STRNCPY(remoteProtocol, curr, tokenLen); + if(tokenLen < MAX_PROTOCOL_LENGTH) { + STRNCPY(remoteProtocol, curr, tokenLen); + } CHK(STRNCMPI("tcp", curr, tokenLen) != 0, STATUS_ICE_CANDIDATE_STRING_IS_TCP); break; case SDP_ICE_CANDIDATE_PARSER_STATE_IP: