[svn-commits] mjordan: branch 13 r430840 - /branches/13/main/rtp_engine.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jan 21 06:57:13 CST 2015


Author: mjordan
Date: Wed Jan 21 06:56:49 2015
New Revision: 430840

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=430840
Log:
main/rtp_engine: Format NTP timestamps as unsigned longs

When the RTCP reports are created, the NTP timestamps are stored as strings,
as JSON does not have an integer type long enough to store the value. However,
on 32-bit systems, a signed long may overflow for some portion of the
timestamp.

This patch corrects the overflow by formatting the timestamps as unsigned
longs.

Modified:
    branches/13/main/rtp_engine.c

Modified: branches/13/main/rtp_engine.c
URL: http://svnview.digium.com/svn/asterisk/branches/13/main/rtp_engine.c?view=diff&rev=430840&r1=430839&r2=430840
==============================================================================
--- branches/13/main/rtp_engine.c (original)
+++ branches/13/main/rtp_engine.c Wed Jan 21 06:56:49 2015
@@ -1947,8 +1947,8 @@
 	if (payload->report->type == AST_RTP_RTCP_SR) {
 		char sec[32];
 		char usec[32];
-		snprintf(sec, sizeof(sec), "%ld", payload->report->sender_information.ntp_timestamp.tv_sec);
-		snprintf(usec, sizeof(usec), "%ld", payload->report->sender_information.ntp_timestamp.tv_usec);
+		snprintf(sec, sizeof(sec), "%lu", payload->report->sender_information.ntp_timestamp.tv_sec);
+		snprintf(usec, sizeof(usec), "%lu", payload->report->sender_information.ntp_timestamp.tv_usec);
 		json_rtcp_sender_info = ast_json_pack("{s: s, s: s, s: i, s: i, s: i}",
 				"ntp_timestamp_sec", sec,
 				"ntp_timestamp_usec", usec,




More information about the svn-commits mailing list