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

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


Richard Mudgett has uploaded a new change for review.

  https://gerrit.asterisk.org/1815

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/15/1815/1

diff --git a/main/utils.c b/main/utils.c
index b4c494e..be4b1bb 100644
--- a/main/utils.c
+++ b/main/utils.c
@@ -2953,14 +2953,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/1815
To unsubscribe, visit https://gerrit.asterisk.org/settings

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



More information about the asterisk-code-review mailing list