Skip to content

Commit

Permalink
Fix problems detected by -fsanitize=address
Browse files Browse the repository at this point in the history
  • Loading branch information
matt335672 committed May 7, 2024
1 parent 67ace5c commit 4e77772
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
9 changes: 8 additions & 1 deletion common/list.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
4 changes: 2 additions & 2 deletions tests/common/test_os_calls_signals.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
1 change: 1 addition & 0 deletions tests/xrdp/test_xrdp_egfx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4e77772

Please sign in to comment.