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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Oct 6 13:24:41 CDT 2017


Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/6667 )

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
  Richard Mudgett: Looks good to me, approved
  Jenkins2: Approved for Submit



diff --git a/main/strings.c b/main/strings.c
index 19aa2d3..3a33323 100644
--- a/main/strings.c
+++ b/main/strings.c
@@ -314,7 +314,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/6667
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-MessageType: merged
Gerrit-Change-Id: Ifcece92605f58116eff24c5a0a3b0ee08b3c87b1
Gerrit-Change-Number: 6667
Gerrit-PatchSet: 1
Gerrit-Owner: 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/9c117e64/attachment-0001.html>


More information about the asterisk-commits mailing list