[Asterisk-code-review] main/strings: Fix uninitialized value. (asterisk[13])

Jenkins2 asteriskteam at digium.com
Fri Oct 6 13:21:33 CDT 2017


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

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 38b4c94..8102c3e 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/6668
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: merged
Gerrit-Change-Id: Ifcece92605f58116eff24c5a0a3b0ee08b3c87b1
Gerrit-Change-Number: 6668
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-code-review/attachments/20171006/c3f89536/attachment.html>


More information about the asterisk-code-review mailing list