Fix off-by-one allocation error in PasswordFromFile(), per Gordon Runkle.
This commit is contained in:
parent
cafebdd4d8
commit
df40e28850
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.199 2002/08/29 23:06:32 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.200 2002/08/30 05:28:50 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -2953,8 +2953,7 @@ PasswordFromFile(char *hostname, char *port, char *dbname,
|
|||||||
(t = pwdfMatchesString(t, dbname)) == NULL ||
|
(t = pwdfMatchesString(t, dbname)) == NULL ||
|
||||||
(t = pwdfMatchesString(t, username)) == NULL)
|
(t = pwdfMatchesString(t, username)) == NULL)
|
||||||
continue;
|
continue;
|
||||||
ret=(char *)malloc(sizeof(char)*strlen(t));
|
ret = strdup(t);
|
||||||
strncpy(ret, t, strlen(t));
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user