[Asterisk-code-review] Fix sscanf() format string type mismatch. (asterisk[13])

Richard Mudgett asteriskteam at digium.com
Mon Dec 14 15:27:16 CST 2015


Richard Mudgett has uploaded a new change for review.

  https://gerrit.asterisk.org/1814

Change subject: Fix sscanf() format string type mismatch.
......................................................................

Fix sscanf() format string type mismatch.

ASTERISK-25615
Reported by: George Joseph

Change-Id: Ieff35307254ca193f3d473cff2e396ca57c7ce0b
---
M main/utils.c
1 file changed, 8 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/14/1814/1

diff --git a/main/utils.c b/main/utils.c
index f06b16c..ffc826e 100644
--- a/main/utils.c
+++ b/main/utils.c
@@ -2958,14 +2958,15 @@
 
 int ast_compare_versions(const char *version1, const char *version2)
 {
-	u_int64_t major[2] = { 0 };
-	u_int64_t minor[2] = { 0 };
-	u_int64_t patch[2] = { 0 };
-	u_int64_t extra[2] = { 0 };
-	u_int64_t v1, v2;
+	unsigned long long int major[2] = { 0 };
+	unsigned long long int minor[2] = { 0 };
+	unsigned long long int patch[2] = { 0 };
+	unsigned long long int extra[2] = { 0 };
+	u_int64_t v1;
+	u_int64_t v2;
 
-	sscanf(version1, "%lu.%lu.%lu.%lu", &major[0], &minor[0], &patch[0], &extra[0]);
-	sscanf(version2, "%lu.%lu.%lu.%lu", &major[1], &minor[1], &patch[1], &extra[1]);
+	sscanf(version1, "%llu.%llu.%llu.%llu", &major[0], &minor[0], &patch[0], &extra[0]);
+	sscanf(version2, "%llu.%llu.%llu.%llu", &major[1], &minor[1], &patch[1], &extra[1]);
 
 	v1 = major[0] << 48 | minor[0] << 32 | patch[0] << 16 | extra[0];
 	v2 = major[1] << 48 | minor[1] << 32 | patch[1] << 16 | extra[1];

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieff35307254ca193f3d473cff2e396ca57c7ce0b
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-code-review mailing list