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

Commitb58d8c9

Browse files
committed
Don't putenv() a string that is allocated in a context that will go away
soon. I suspect this explains bug #3902, though I'm still not able toreproduce that.
1 parent65b39ec commitb58d8c9

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

‎src/backend/libpq/auth.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/libpq/auth.c,v 1.162 2008/01/01 19:45:49 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/libpq/auth.c,v 1.163 2008/01/30 04:11:19 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -384,7 +384,6 @@ pg_GSS_recvauth(Port *port)
384384
min_stat,
385385
lmin_s,
386386
gflags;
387-
char*kt_path;
388387
intmtype;
389388
intret;
390389
StringInfoDatabuf;
@@ -398,11 +397,19 @@ pg_GSS_recvauth(Port *port)
398397
* setenv("KRB5_KTNAME", pg_krb_server_keyfile, 0); except setenv()
399398
* not always available.
400399
*/
401-
if (!getenv("KRB5_KTNAME"))
400+
if (getenv("KRB5_KTNAME")==NULL)
402401
{
403-
kt_path=palloc(MAXPGPATH+13);
404-
snprintf(kt_path,MAXPGPATH+13,
405-
"KRB5_KTNAME=%s",pg_krb_server_keyfile);
402+
size_tkt_len=strlen(pg_krb_server_keyfile)+14;
403+
char*kt_path=malloc(kt_len);
404+
405+
if (!kt_path)
406+
{
407+
ereport(LOG,
408+
(errcode(ERRCODE_OUT_OF_MEMORY),
409+
errmsg("out of memory")));
410+
returnSTATUS_ERROR;
411+
}
412+
snprintf(kt_path,kt_len,"KRB5_KTNAME=%s",pg_krb_server_keyfile);
406413
putenv(kt_path);
407414
}
408415
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp