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

Commit3a5d0c5

Browse files
committed
Avoid reading below the start of a stack variable in tokenize_file().
We would wrongly overwrite the prior stack byte if it happened tocontain '\n' or '\r'. New in 9.3, so no back-patch.
1 parent813895e commit3a5d0c5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎src/backend/libpq/hba.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,9 @@ tokenize_file(const char *filename, FILE *file,
411411
line_number,filename)));
412412

413413
/* Strip trailing linebreak from rawline */
414-
while (rawline[strlen(rawline)-1]=='\n'||
415-
rawline[strlen(rawline)-1]=='\r')
416-
rawline[strlen(rawline)-1]='\0';
414+
lineptr=rawline+strlen(rawline)-1;
415+
while (lineptr >=rawline&& (*lineptr=='\n'||*lineptr=='\r'))
416+
*lineptr--='\0';
417417

418418
lineptr=rawline;
419419
while (strlen(lineptr)>0)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp