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

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


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



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/66/6666/1

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: newchange
Gerrit-Change-Id: Ifcece92605f58116eff24c5a0a3b0ee08b3c87b1
Gerrit-Change-Number: 6666
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/cb9afc9d/attachment-0001.html>


More information about the asterisk-code-review mailing list