Fix problems detected by -fsanitize=address

This commit is contained in:
matt335672 2024-05-07 12:01:50 +01:00
parent 67ace5c59d
commit 4e77772ea2
3 changed files with 11 additions and 3 deletions

View File

@ -345,7 +345,14 @@ int
split_string_append_fragment(const char **start, const char *end,
struct list *list)
{
const unsigned int len = end - *start;
unsigned int len = end - *start;
// Check for an unexpected terminator in the string
const char *term = (const char *)memchr(*start, '\0', len);
if (term != NULL)
{
end = term;
len = end - *start;
}
char *copy = (char *)malloc(len + 1);
if (copy == NULL)
{

View File

@ -111,7 +111,7 @@ START_TEST(test_g_signal_child_stop_1)
// Before raising the signal, change directory to a non-writeable
// one to avoid generating a corefile.
g_set_current_dir("/");
raise(SIGSEGV);
raise(SIGUSR2);
}
ck_assert_int_ne(pid, 0);
g_obj_wait(&g_wobj1, 1, NULL, 0, 2000);
@ -120,7 +120,7 @@ START_TEST(test_g_signal_child_stop_1)
e = g_waitpid_status(pid);
ck_assert_int_eq(e.reason, E_PXR_SIGNAL);
ck_assert_int_eq(e.val, SIGSEGV);
ck_assert_int_eq(e.val, SIGUSR2);
// Clean up
g_signal_child_stop(NULL);

View File

@ -54,6 +54,7 @@ START_TEST(test_xrdp_egfx_send_create_surface__happy_path)
in_uint8(s, descriptor);
ck_assert_int_eq(0xE0, descriptor);
free_stream(s);
g_free(bulk);
}
END_TEST