Skip to content

Commit 205b5c2

Browse files
committed
A little paranoia never hurt anyone.
1 parent c0e9dc1 commit 205b5c2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/backend/utils/misc/database.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.49 2001/10/25 05:49:51 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.50 2002/05/05 17:50:04 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -222,8 +222,10 @@ GetRawDatabaseInfo(const char *name, Oid *db_id, char *path)
222222
/* Found it; extract the OID and the database path. */
223223
*db_id = tup.t_data->t_oid;
224224
pathlen = VARSIZE(&(tup_db->datpath)) - VARHDRSZ;
225+
if (pathlen < 0)
226+
pathlen = 0; /* pure paranoia */
225227
if (pathlen >= MAXPGPATH)
226-
pathlen = MAXPGPATH - 1; /* pure paranoia */
228+
pathlen = MAXPGPATH - 1; /* more paranoia */
227229
strncpy(path, VARDATA(&(tup_db->datpath)), pathlen);
228230
path[pathlen] = '\0';
229231
goto done;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy