From 772f417cd78ffdac6a5c0adef6d29002b1211597 Mon Sep 17 00:00:00 2001 From: Timo Teräs Date: Mon, 3 Jan 2011 19:15:35 +0200 Subject: version: fix evaluation order to make valgrind happy otherwise we get reads from uninitialized/unallocated memory. (cherry picked from commit 1f42cc1aed32ebf160db5e812d2f57e654042522) --- src/version.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/version.c b/src/version.c index 34c5f1a..3c9e139 100644 --- a/src/version.c +++ b/src/version.c @@ -85,7 +85,7 @@ static int get_token(int *type, apk_blob_t *blob) case TOKEN_DIGIT_OR_ZERO: /* Leading zero digits get a special treatment */ if (blob->ptr[i] == '0') { - while (blob->ptr[i] == '0' && i < blob->len) + while (i < blob->len && blob->ptr[i] == '0') i++; nt = TOKEN_DIGIT; v = -i; @@ -94,7 +94,7 @@ static int get_token(int *type, apk_blob_t *blob) case TOKEN_DIGIT: case TOKEN_SUFFIX_NO: case TOKEN_REVISION_NO: - while (isdigit(blob->ptr[i]) && i < blob->len) { + while (i < blob->len && isdigit(blob->ptr[i])) { v *= 10; v += blob->ptr[i++] - '0'; } -- cgit v1.2.3-70-g09d2