Skip to content

Commit ddf201c

Browse files
committed
Improve buffer safty
1 parent 83050ec commit ddf201c

File tree

1 file changed

+2
-2
lines changed
  • src/backend/access/transam

1 file changed

+2
-2
lines changed

src/backend/access/transam/xlog.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5440,7 +5440,7 @@ int GetDatabaseStyleFromControl(char* path)
54405440
else
54415441
configdir = make_absolute_path(getenv("PGDATA"));
54425442

5443-
sprintf(pathname,"%s/%s",configdir,XLOG_CONTROL_FILE);
5443+
snprintf(pathname, sizeof(pathname), "%s/%s", configdir, XLOG_CONTROL_FILE);
54445444

54455445
fd = open(pathname, O_RDONLY | PG_BINARY, 0);
54465446

@@ -5482,7 +5482,7 @@ int GetCaseSwitchModeFromControl(char* path)
54825482
else
54835483
configdir = make_absolute_path(getenv("PGDATA"));
54845484

5485-
sprintf(pathname,"%s/%s",configdir,XLOG_CONTROL_FILE);
5485+
snprintf(pathname, sizeof(pathname), "%s/%s", configdir, XLOG_CONTROL_FILE);
54865486

54875487
fd = open(pathname, O_RDONLY | PG_BINARY, 0);
54885488

0 commit comments

Comments
 (0)