This is an automated email from the ASF dual-hosted git repository.

yjhjstz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit 6b8da0727e5e777a65a1ae9be8963af6a14db5b1
Author: reshke <[email protected]>
AuthorDate: Mon Aug 22 06:54:59 2022 +0500

    Fix compile-time warn in pg_basebackup code.
    
    Change sprintf function to snprintf, to check resulting
    buffer size overflow.
---
 src/bin/pg_basebackup/pg_basebackup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/pg_basebackup/pg_basebackup.c 
b/src/bin/pg_basebackup/pg_basebackup.c
index 53be313b22..887bb79889 100644
--- a/src/bin/pg_basebackup/pg_basebackup.c
+++ b/src/bin/pg_basebackup/pg_basebackup.c
@@ -2171,7 +2171,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);
                }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to