[pacman-dev] [PATCH] pacsort: fix warning about signed overflow potential during comparison.

Allan McRae allan at archlinux.org
Thu Apr 23 06:50:51 UTC 2015


From: Andrew Gregory <andrew.gregory.8 at gmail.com>

Some crazy person assumed we would have fewer than INT_MAX columns.

Signed-off-by: Allan McRae <allan at archlinux.org>
---
 src/util/pacsort.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/pacsort.c b/src/util/pacsort.c
index 9d248fa..b0137ec 100644
--- a/src/util/pacsort.c
+++ b/src/util/pacsort.c
@@ -308,7 +308,7 @@ static const char *nth_column(const char *string)
 	int col;
 
 	ptr = prev = string;
-	for(col = 1; ptr && col <= opts.sortkey; col++) {
+	for(col = 0; ptr && col < opts.sortkey; col++) {
 		prev = ptr;
 		ptr = strchr(ptr, opts.delim);
 		if(ptr) {
-- 
2.3.5


More information about the pacman-dev mailing list