Fix compile-time warn in pg_basebackup code.
Change sprintf function to snprintf, to check resulting
buffer size overflow.
@@ -1986,7 +1986,7 @@ BaseBackup(void)
char *path = unconstify(char *, get_tablespace_mapping(PQgetvalue(res, i, 1)));
char path_with_subdir[MAXPGPATH];
- sprintf(path_with_subdir, "%s/%d/%s", path, target_gp_dbid, GP_TABLESPACE_VERSION_DIRECTORY);
+ snprintf(path_with_subdir, MAXPGPATH, "%s/%d/%s", path, target_gp_dbid, GP_TABLESPACE_VERSION_DIRECTORY);
verify_dir_is_empty_or_create(path_with_subdir, &made_tablespace_dirs, &found_tablespace_dirs);
}
