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

Commitf749b4c

Browse files
committed
Pay attention to fgets() failure return.
1 parent92fd384 commitf749b4c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

‎src/backend/libpq/password.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
33
* Portions Copyright (c) 1994, Regents of the University of California
44
*
5-
* $Id: password.c,v 1.32 2000/08/2721:50:18 tgl Exp $
5+
* $Id: password.c,v 1.33 2000/11/2703:43:49 tgl Exp $
66
*
77
*/
88

@@ -56,9 +56,11 @@ verify_password(const Port *port, const char *user, const char *password)
5656
*test_user,
5757
*test_pw;
5858

59-
fgets(pw_file_line,sizeof(pw_file_line),pw_file);
59+
if (fgets(pw_file_line,sizeof(pw_file_line),pw_file)==NULL)
60+
pw_file_line[0]='\0';
6061
/* kill the newline */
61-
if (pw_file_line[strlen(pw_file_line)-1]=='\n')
62+
if (strlen(pw_file_line)>0&&
63+
pw_file_line[strlen(pw_file_line)-1]=='\n')
6264
pw_file_line[strlen(pw_file_line)-1]='\0';
6365

6466
p=pw_file_line;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp