From 4274cbe5352a63cd0b9a04e905d798057054a4dc Mon Sep 17 00:00:00 2001 From: Hassan Sahibzada Date: Thu, 25 Jul 2024 14:07:56 -0400 Subject: [PATCH] fix bug 32 bit system reading 8 bytes for pointer results in reading part of adjacent fields --- src/source/PeerConnection/SessionDescription.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/source/PeerConnection/SessionDescription.c b/src/source/PeerConnection/SessionDescription.c index 215bdb6a96..7f55f94745 100644 --- a/src/source/PeerConnection/SessionDescription.c +++ b/src/source/PeerConnection/SessionDescription.c @@ -415,13 +415,13 @@ STATUS populateSingleMediaSection(PKvsPeerConnection pKvsPeerConnection, PKvsRtp { ENTERS(); STATUS retStatus = STATUS_SUCCESS; - UINT64 payloadType, rtxPayloadType; + UINT64 payloadType, rtxPayloadType, rtpMapValue; BOOL containRtx = FALSE; BOOL directionFound = FALSE; UINT32 i, remoteAttributeCount, attributeCount = 0; PRtcMediaStreamTrack pRtcMediaStreamTrack = &(pKvsRtpTransceiver->sender.track); PSdpMediaDescription pSdpMediaDescriptionRemote; - PCHAR currentFmtp = NULL, rtpMapValue = NULL; + PCHAR currentFmtp = NULL, rtpMapValueChar = NULL; CHAR remoteSdpAttributeValue[MAX_SDP_ATTRIBUTE_VALUE_LENGTH]; INT32 amountWritten = 0; @@ -795,11 +795,12 @@ STATUS populateSingleMediaSection(PKvsPeerConnection pKvsPeerConnection, PKvsRtp attributeCount++; } } else if (pRtcMediaStreamTrack->codec == RTC_CODEC_UNKNOWN) { - CHK_STATUS(hashTableGet(pUnknownCodecRtpmapTable, unknownCodecHashTableKey, (PUINT64) &rtpMapValue)); + CHK_STATUS(hashTableGet(pUnknownCodecRtpmapTable, unknownCodecHashTableKey, &rtpMapValue)); + rtpMapValueChar = (PCHAR) rtpMapValue; STRCPY(pSdpMediaDescription->sdpAttributes[attributeCount].attributeName, "rtpmap"); amountWritten = SNPRINTF(pSdpMediaDescription->sdpAttributes[attributeCount].attributeValue, - SIZEOF(pSdpMediaDescription->sdpAttributes[attributeCount].attributeValue), "%" PRId64 " %s", payloadType, rtpMapValue); + SIZEOF(pSdpMediaDescription->sdpAttributes[attributeCount].attributeValue), "%" PRId64 " %s", payloadType, rtpMapValueChar); CHK_ERR(amountWritten > 0, STATUS_INTERNAL_ERROR, "Full Unknown rtpmap could not be written"); attributeCount++; }