mirror of
https://github.com/MariaDB/server.git
synced 2026-10-23 18:49:29 +03:00
MDEV-39173: Use snprintf in the remaining sprintf calls
Convert all three calls to snprintf. 12.3 already has the same change
for slave.cc, made in merge commit 9f98f82b14.
MDEV-39173 replaced sprintf with snprintf in 10.11 and removed the
pragma in violite.h that hid deprecation warnings. Two calls in
slave.cc and one in mysqltest.cc were added after 10.11, so 11.4 was
out of date and produces sprintf deprecation warnings (at least on
macOS).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
committed by
Daniel Black
parent
11fe730ef2
commit
79655b07dc
@@ -5350,7 +5350,8 @@ void do_sync_with_master2(struct st_command *command, long offset,
|
||||
/* master_pos_wait returned NULL or < 0 */
|
||||
fprintf(stderr, "analyze: sync_with_master\n");
|
||||
|
||||
sprintf(query_buf2, "show slave \"%s\" status", connection_name);
|
||||
snprintf(query_buf2, sizeof(query_buf2), "show slave \"%s\" status",
|
||||
connection_name);
|
||||
|
||||
if (!mysql_query(mysql, query_buf2))
|
||||
{
|
||||
|
||||
@@ -2725,7 +2725,8 @@ after_set_capability:
|
||||
"The slave I/O thread stops because a fatal out-of-memory error "
|
||||
"is encountered when it tries to set "
|
||||
"@slave_gtid_until_before_gtids.";
|
||||
sprintf(err_buff, "%s Error: Out of memory", errmsg);
|
||||
snprintf(err_buff, sizeof(err_buff), "%s Error: Out of memory",
|
||||
errmsg);
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -2745,7 +2746,8 @@ after_set_capability:
|
||||
/* Fatal error */
|
||||
errmsg= "The slave I/O thread stops because a fatal error is "
|
||||
"encountered when it tries to set @slave_gtid_until_before_gtids.";
|
||||
sprintf(err_buff, "%s Error: %s", errmsg, mysql_error(mysql));
|
||||
snprintf(err_buff, sizeof(err_buff), "%s Error: %s", errmsg,
|
||||
mysql_error(mysql));
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user