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

Commit2e62fa6

Browse files
committed
Avoid core dump after getpwuid_r failure.
Looking up a nonexistent user ID would lead to a null pointerdereference. That's unlikely to happen here, but perhapsnot impossible.Thinko in commit4d5111b, noticed by Coverity.
1 parentd8df7ac commit2e62fa6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

‎src/interfaces/libpq/fe-auth.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,7 @@ pg_fe_getusername(uid_t user_id, PQExpBuffer errorMessage)
12051205
DWORDnamesize=sizeof(username);
12061206
#else
12071207
structpasswdpwbuf;
1208-
structpasswd*pw;
1208+
structpasswd*pw=NULL;
12091209
charbuf[1024];
12101210
intrc;
12111211
#endif
@@ -1230,7 +1230,8 @@ pg_fe_getusername(uid_t user_id, PQExpBuffer errorMessage)
12301230
if (errorMessage)
12311231
libpq_append_error(errorMessage,"local user with ID %ld does not exist", (long)user_id);
12321232
}
1233-
name=pw->pw_name;
1233+
else
1234+
name=pw->pw_name;
12341235
#endif
12351236

12361237
if (name)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp