[PATCH] Fix off-by-one in PQprintTuples()

Поиск
Список
Период
Сортировка
От Xi Wang
Тема [PATCH] Fix off-by-one in PQprintTuples()
Дата
Msg-id 1358657511-32752-1-git-send-email-xi.wang@gmail.com
обсуждение исходный текст
Ответы Re: [PATCH] Fix off-by-one in PQprintTuples()  (Stephen Frost <sfrost@snowman.net>)
Список pgsql-hackers
Don't write past the end of tborder; the size is width + 1.
---src/interfaces/libpq/fe-print.c |    2 +-1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/interfaces/libpq/fe-print.c b/src/interfaces/libpq/fe-print.c
index 076e1cc..7ed489a 100644
--- a/src/interfaces/libpq/fe-print.c
+++ b/src/interfaces/libpq/fe-print.c
@@ -706,7 +706,7 @@ PQprintTuples(const PGresult *res,                fprintf(stderr, libpq_gettext("out of
memory\n"));               abort();            }
 
-            for (i = 0; i <= width; i++)
+            for (i = 0; i < width; i++)                tborder[i] = '-';            tborder[i] = '\0';
fprintf(fout,"%s\n", tborder);
 
-- 
1.7.10.4




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Xi Wang
Дата:
Сообщение: [PATCH] Fix NULL checking in check_TSCurrentConfig()
Следующее
От: Amit kapila
Дата:
Сообщение: Re: Review: Patch to compute Max LSN of Data Pages