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

Commitdf40e28

Browse files
committed
Fix off-by-one allocation error in PasswordFromFile(), per Gordon Runkle.
1 parentcafebdd commitdf40e28

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.199 2002/08/29 23:06:32 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.200 2002/08/30 05:28:50 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -2953,8 +2953,7 @@ PasswordFromFile(char *hostname, char *port, char *dbname,
29532953
(t=pwdfMatchesString(t,dbname))==NULL||
29542954
(t=pwdfMatchesString(t,username))==NULL)
29552955
continue;
2956-
ret=(char*)malloc(sizeof(char)*strlen(t));
2957-
strncpy(ret,t,strlen(t));
2956+
ret=strdup(t);
29582957
fclose(fp);
29592958
returnret;
29602959
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp