Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf96baba

Browse files
committed
While I was running some tests in psql, trying to figure out how to change
the query string to handle any length, I discovered that under certainconditions, psql will core dump when handling long strings. Thus, thepatch. It was caused by a buffer overrun, probably not noticeable in a lotof cases, but pretty noticeable in mine.Problem was caused by the fact that the length check is only performed afterthe check for a ; to get the end of the query and execute.Cheers...MikeA
1 parenta2bb39c commitf96baba

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

‎src/bin/psql/psql.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.187 1999/07/19 21:06:19 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.188 1999/07/20 17:20:43 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -2705,7 +2705,8 @@ MainLoop(PsqlSettings *pset, char *query, FILE *source)
27052705
charhold_char=line[i+thislen];
27062706

27072707
line[i+thislen]='\0';
2708-
if (query_start[0]!='\0')
2708+
if ((query_start[0]!='\0')&&
2709+
(strlen(query)+strlen(query_start) <=MAX_QUERY_BUFFER))
27092710
{
27102711
if (query[0]!='\0')
27112712
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp