We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 34741de commit b1442f4Copy full SHA for b1442f4
src/dir.c
@@ -1160,9 +1160,10 @@ read_tablespace_map(parray *links, const char *backup_dir)
1160
1161
path = buf + n;
1162
1163
- /* Remove newline character at the end of string */
1164
- i = strlen(path) - 1;
1165
- path[i] = '\0';
+ /* Remove newline character at the end of string if any */
+ i = strcspn(path, "\n");
+ if (strlen(path) > i)
1166
+ path[i] = '\0';
1167
1168
file = pgut_new(pgFile);
1169
memset(file, 0, sizeof(pgFile));
0 commit comments