summaryrefslogtreecommitdiff
path: root/client/mysqltest.cc
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2023-01-31 09:31:42 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2023-01-31 09:31:42 +0100
commitc3a5cf2b5bb0c0e1623a0ddc8e3d49557f35e800 (patch)
tree0e47046f09c1ad4a4223e45d7ac2c41406272b92 /client/mysqltest.cc
parent81196469bbc6b8424c97a378e5fc5b16d40b43b5 (diff)
parentf8a85af8ca1c937b8d4f847477bd282f80251cde (diff)
downloadmariadb-git-c3a5cf2b5bb0c0e1623a0ddc8e3d49557f35e800.tar.gz
Merge branch '10.5' into 10.6
Diffstat (limited to 'client/mysqltest.cc')
-rw-r--r--client/mysqltest.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index ff9992de3b1..0f553cab3f3 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -6182,7 +6182,9 @@ int do_done(struct st_command *command)
if (*cur_block->delim)
{
/* Restore "old" delimiter after false if block */
- strcpy (delimiter, cur_block->delim);
+ if (safe_strcpy(delimiter, sizeof(delimiter), cur_block->delim))
+ die("Delimiter too long, truncated");
+
delimiter_length= strlen(delimiter);
}
/* Pop block from stack, goto next line */
@@ -6437,10 +6439,12 @@ void do_block(enum block_cmd cmd, struct st_command* command)
if (cur_block->ok)
{
cur_block->delim[0]= '\0';
- } else
+ }
+ else
{
/* Remember "old" delimiter if entering a false if block */
- strcpy (cur_block->delim, delimiter);
+ if (safe_strcpy(cur_block->delim, sizeof(cur_block->delim), delimiter))
+ die("Delimiter too long, truncated");
}
DBUG_PRINT("info", ("OK: %d", cur_block->ok));
@@ -11846,9 +11850,8 @@ static int setenv(const char *name, const char *value, int overwrite)
char *envvar= (char *)malloc(buflen);
if(!envvar)
return ENOMEM;
- strcpy(envvar, name);
- strcat(envvar, "=");
- strcat(envvar, value);
+
+ snprintf(envvar, buflen, "%s=%s", name, value);
putenv(envvar);
return 0;
}