Cleanup: remove use of unsafe string functions
This commit is contained in:
@@ -2378,8 +2378,7 @@ char *GHOST_SystemWin32::getClipboard(bool /*selection*/) const
|
||||
|
||||
len = strlen(buffer);
|
||||
char *temp_buff = (char *)malloc(len + 1);
|
||||
strncpy(temp_buff, buffer, len);
|
||||
temp_buff[len] = '\0';
|
||||
memcpy(temp_buff, buffer, len + 1);
|
||||
|
||||
/* Buffer mustn't be accessed after CloseClipboard
|
||||
* it would like accessing free-d memory */
|
||||
|
||||
@@ -1153,7 +1153,7 @@ TEST_F(ActionLayersTest, conversion_to_layered_action_groups)
|
||||
ASSERT_NE(rename_group, nullptr);
|
||||
ASSERT_STREQ(rename_group->name, "Test_Rename");
|
||||
/* Forcing a duplicate name which was allowed by legacy actions. */
|
||||
strcpy(rename_group->name, "Test");
|
||||
STRNCPY_UTF8(rename_group->name, "Test");
|
||||
|
||||
Action *converted = convert_to_layered_action(*bmain, *action);
|
||||
Strip *strip = converted->layer(0)->strip(0);
|
||||
|
||||
@@ -417,16 +417,16 @@ static void bli_windows_exception_message_get(const EXCEPTION_POINTERS *exceptio
|
||||
bli_windows_get_module_name(address, modulename, sizeof(modulename));
|
||||
DWORD threadId = GetCurrentThreadId();
|
||||
|
||||
snprintf(r_message,
|
||||
512,
|
||||
"Error : %s\n"
|
||||
"Address : 0x%p\n"
|
||||
"Module : %s\n"
|
||||
"Thread : %.8x\n",
|
||||
exception_name,
|
||||
address,
|
||||
modulename,
|
||||
threadId);
|
||||
BLI_snprintf(r_message,
|
||||
512,
|
||||
"Error : %s\n"
|
||||
"Address : 0x%p\n"
|
||||
"Module : %s\n"
|
||||
"Thread : %.8x\n",
|
||||
exception_name,
|
||||
address,
|
||||
modulename,
|
||||
threadId);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
@@ -360,7 +360,7 @@ TEST(string, StringNLenUTF8_Incomplete)
|
||||
#define EXPECT_BYTE_OFFSET(truncate_ofs, expect_nchars) \
|
||||
{ \
|
||||
size_t buf_ofs = 0; \
|
||||
strcpy(buf, ref_str); \
|
||||
STRNCPY(buf, ref_str); \
|
||||
buf[truncate_ofs] = '\0'; \
|
||||
EXPECT_EQ(BLI_strnlen_utf8_ex(buf, ref_str_len, &buf_ofs), expect_nchars); \
|
||||
EXPECT_EQ(buf_ofs, truncate_ofs); \
|
||||
|
||||
Reference in New Issue
Block a user