diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2007-02-07 00:52:35 +0000 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2007-02-07 00:52:35 +0000 |
commit | 16059d39a04f5307e9b4dade10e70e5a4939a6db (patch) | |
tree | e9c9a3248870a743e30edbba47c0092ecf8b1832 /src/backend | |
parent | f11aa82d0378c48da9fc67e479699a1f8bb99483 (diff) |
Replace some strncpy() by strlcpy().
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/libpq/be-secure.c | 6 | ||||
-rw-r--r-- | src/backend/utils/fmgr/dfmgr.c | 5 | ||||
-rw-r--r-- | src/backend/utils/misc/guc.c | 5 |
3 files changed, 7 insertions, 9 deletions
diff --git a/src/backend/libpq/be-secure.c b/src/backend/libpq/be-secure.c index ac0196cead4..8a54275d9cd 100644 --- a/src/backend/libpq/be-secure.c +++ b/src/backend/libpq/be-secure.c @@ -11,7 +11,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/libpq/be-secure.c,v 1.76 2007/01/26 20:06:52 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/libpq/be-secure.c,v 1.77 2007/02/07 00:52:35 petere Exp $ * * Since the server static private key ($DataDir/server.key) * will normally be stored unencrypted so that the database @@ -933,8 +933,8 @@ aloop: port->peer = SSL_get_peer_certificate(port->ssl); if (port->peer == NULL) { - strncpy(port->peer_dn, "(anonymous)", sizeof(port->peer_dn)); - strncpy(port->peer_cn, "(anonymous)", sizeof(port->peer_cn)); + strlcpy(port->peer_dn, "(anonymous)", sizeof(port->peer_dn)); + strlcpy(port->peer_cn, "(anonymous)", sizeof(port->peer_cn)); } else { diff --git a/src/backend/utils/fmgr/dfmgr.c b/src/backend/utils/fmgr/dfmgr.c index fdbcc69cdec..f660c19e29b 100644 --- a/src/backend/utils/fmgr/dfmgr.c +++ b/src/backend/utils/fmgr/dfmgr.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.93 2007/01/05 22:19:43 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.94 2007/02/07 00:52:35 petere Exp $ * *------------------------------------------------------------------------- */ @@ -539,8 +539,7 @@ find_in_dynamic_libpath(const char *basename) len = piece - p; piece = palloc(len + 1); - strncpy(piece, p, len); - piece[len] = '\0'; + strlcpy(piece, p, len + 1); mangled = substitute_libpath_macro(piece); pfree(piece); diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 1c8a4893d95..f7e6536f93d 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -10,7 +10,7 @@ * Written by Peter Eisentraut <peter_e@gmx.net>. * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.372 2007/02/01 19:10:28 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.373 2007/02/07 00:52:35 petere Exp $ * *-------------------------------------------------------------------- */ @@ -5729,8 +5729,7 @@ ParseLongOption(const char *string, char **name, char **value) if (string[equal_pos] == '=') { *name = guc_malloc(FATAL, equal_pos + 1); - strncpy(*name, string, equal_pos); - (*name)[equal_pos] = '\0'; + strlcpy(*name, string, equal_pos + 1); *value = guc_strdup(FATAL, &string[equal_pos + 1]); } |