From f891d6a35c28fc25bae39ac466b9ae203f219eb5 Mon Sep 17 00:00:00 2001
From: Pavel Raiskup <praiskup@redhat.com>
Date: Mon, 6 Jan 2014 09:26:43 +0100
Subject: [PATCH] Fix off-by-one overrun

Detected by Coverity
---
 info.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/info.c b/info.c
index 9fd034f..14e3876 100644
--- a/info.c
+++ b/info.c
@@ -1686,11 +1686,11 @@ retry_public_schema:
 #else
 	prefix[i] = strtok(prefixes, ";");
 #endif /* HAVE_STRTOK_R */
-	while (i < sizeof(prefix) / sizeof(char *) && prefix[i])
+	for (i++; i < sizeof(prefix) / sizeof(char *) && prefix[i]; i++)
 #ifdef	HAVE_STRTOK_R
-		prefix[++i] = strtok_r(NULL, ";", &last);
+		prefix[i] = strtok_r(NULL, ";", &last);
 #else
-		prefix[++i] = strtok(NULL, ";");
+		prefix[i] = strtok(NULL, ";");
 #endif /* HAVE_STRTOK_R */
 
 	/* Parse the desired table types to return */
@@ -1720,11 +1720,11 @@ retry_public_schema:
 #else
 		table_type[i] = strtok(table_types, ",");
 #endif /* HAVE_STRTOK_R */
-		while (i < sizeof(table_type) / sizeof(char *) && table_type[i])
+		for (i++; i < sizeof(table_type) / sizeof(char *) && table_type[i]; i++)
 #ifdef	HAVE_STRTOK_R
-			table_type[++i] = strtok_r(NULL, ",", &last);
+			table_type[i] = strtok_r(NULL, ",", &last);
 #else
-			table_type[++i] = strtok(NULL, ",");
+			table_type[i] = strtok(NULL, ",");
 #endif /* HAVE_STRTOK_R */
 
 		/* Check for desired table types to return */
-- 
1.8.4.2

