[asterisk-commits] main/strings: Fix uninitialized value. (asterisk[15])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Oct 6 15:09:49 CDT 2017


George Joseph has submitted this change and it was merged. ( https://gerrit.asterisk.org/6666 )

Change subject: main/strings: Fix uninitialized value.
......................................................................

main/strings: Fix uninitialized value.

ast_strings_match uses sscanf and checks for non-zero return to verify a
token was parsed. This is incorrect as sscanf returns EOF (-1) for errors.

ASTERISK-27318 #close

Change-Id: Ifcece92605f58116eff24c5a0a3b0ee08b3c87b1
---
M main/strings.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  George Joseph: Looks good to me, but someone else must approve; Approved for Submit
  Richard Mudgett: Looks good to me, approved



diff --git a/main/strings.c b/main/strings.c
index 3207fa1..82e315a 100644
--- a/main/strings.c
+++ b/main/strings.c
@@ -312,7 +312,7 @@
 	}
 
 equals:
-	scan_numeric = (sscanf(left, "%lf", &left_num) && sscanf(internal_right, "%lf", &right_num));
+	scan_numeric = (sscanf(left, "%lf", &left_num) > 0 && sscanf(internal_right, "%lf", &right_num) > 0);
 
 	if (internal_op[0] == '=') {
 		if (ast_strlen_zero(left) && ast_strlen_zero(internal_right)) {

-- 
To view, visit https://gerrit.asterisk.org/6666
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: merged
Gerrit-Change-Id: Ifcece92605f58116eff24c5a0a3b0ee08b3c87b1
Gerrit-Change-Number: 6666
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-commits/attachments/20171006/7eb0c809/attachment-0001.html>


More information about the asterisk-commits mailing list