Skip to content

Commit b1442f4

Browse files
committed
[Issue #364] correctly set null-termination char during tablespace_map parsing
1 parent 34741de commit b1442f4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/dir.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,9 +1160,10 @@ read_tablespace_map(parray *links, const char *backup_dir)
11601160

11611161
path = buf + n;
11621162

1163-
/* Remove newline character at the end of string */
1164-
i = strlen(path) - 1;
1165-
path[i] = '\0';
1163+
/* Remove newline character at the end of string if any */
1164+
i = strcspn(path, "\n");
1165+
if (strlen(path) > i)
1166+
path[i] = '\0';
11661167

11671168
file = pgut_new(pgFile);
11681169
memset(file, 0, sizeof(pgFile));

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