Skip to content

Commit

Permalink
Extend ACE_UNIX_Addr::addr_to_string unit test for bounds checking
Browse files Browse the repository at this point in the history
  • Loading branch information
likema committed Feb 7, 2025
1 parent 65feda9 commit d5dff06
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ACE/tests/UNIX_Addr_Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,18 @@ int run_main (int, ACE_TCHAR *[])
ACE_TEST_ASSERT (strcmp (path, ACE_TEXT_ALWAYS_CHAR(buf)) == 0);
ACE_TEST_ASSERT (strcmp (path, addr.get_path_name ()) == 0);

// Bounds checking
path = "/tmp/bounds.test";
addr.set (path);
ACE_TEST_ASSERT (addr.addr_to_string (nullptr, sizeof (buf)) == -1);
ACE_TEST_ASSERT (addr.addr_to_string (buf, 0) == -1);

#if defined(ACE_LINUX)
// Bounds checking for abstract path
path = "@/tmp/bounds.test";
addr.set (path);
ACE_TEST_ASSERT (addr.addr_to_string (buf, 1) == -1);

// Set abstract path by set.
path = "@/tmp/ace.test";
addr.set (path);
Expand Down

0 comments on commit d5dff06

Please sign in to comment.