[Asterisk-code-review] chan_sip.c: Fixed compile warning (...asterisk[master])

sungtae kim asteriskteam at digium.com
Thu Mar 28 19:19:16 CDT 2019


sungtae kim has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/11202


Change subject: chan_sip.c: Fixed compile warning
......................................................................

chan_sip.c: Fixed compile warning

Fixed uninitialized compile warning for chan_sip.c.

ASTERISK-28362

Change-Id: Id015040942b235fbbbd02219572916aadd537f42
---
M channels/chan_sip.c
1 file changed, 4 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/02/11202/1

diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index b5bfad4..8039d40 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -11642,11 +11642,12 @@
 		red_cp = &red_fmtp[strlen(red_fmtp)];
 		strncpy(red_fmtp, a, 100);
 
-		sscanf(red_cp, "%30u", (unsigned *)&red_data_pt[*red_num_gen]);
-		red_cp = strtok_r(red_cp, "/", &rest);
-		while (red_cp && (*red_num_gen)++ < AST_RED_MAX_GENERATION) {
+		while (1) {
 			sscanf(red_cp, "%30u", (unsigned *)&red_data_pt[*red_num_gen]);
 			red_cp = strtok_r(NULL, "/", &rest);
+			if (!red_cp || (*red_num_gen)++ >= AST_RED_MAX_GENERATION) {
+				break;
+			}
 		}
 		red_cp = red_fmtp;
 		found = TRUE;

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/11202
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Id015040942b235fbbbd02219572916aadd537f42
Gerrit-Change-Number: 11202
Gerrit-PatchSet: 1
Gerrit-Owner: sungtae kim <pchero21 at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190328/83b22d0f/attachment.html>


More information about the asterisk-code-review mailing list