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

Appearance settings

Commit b1442f4

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

File tree

1 file changed

+4
-3
lines changed
Filter options

1 file changed

+4
-3
lines changed

‎src/dir.c

Copy file name to clipboardExpand all lines: src/dir.c
+4-3Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.