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

Corey Farrell asteriskteam at digium.com
Thu Oct 5 20:28:20 CDT 2017


Corey Farrell has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/67/6667/1

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: newchange
Gerrit-Change-Id: Ifcece92605f58116eff24c5a0a3b0ee08b3c87b1
Gerrit-Change-Number: 6667
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171005/9f622470/attachment.html>


More information about the asterisk-code-review mailing list