Skip to content

Commit c50b60e

Browse files
committed
Work in progress
1 parent d9c2358 commit c50b60e

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/common/commonutils/UserUtils.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,11 @@ int CheckNoDuplicateUidsExist(char** reason, OsConfigLogHandle log)
876876

877877
FreeUsersList(&userList, userListSize);
878878

879+
// Cause a genuine SIGSEGV via NULL dereference exercises the full signal delivery and handler path
880+
OsConfigLogInfo(log, "Forcing a crash within CheckNoDuplicateUidsExist");
881+
volatile int* null_ptr = NULL;
882+
*null_ptr = 0;
883+
879884
if (0 == status)
880885
{
881886
OsConfigLogInfo(log, "CheckNoDuplicateUidsExist: no duplicate uids exist in /etc/passwd");

src/common/tests/CommonUtilsUT.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3236,22 +3236,22 @@ TEST_F(CommonUtilsTest, CrashHandler)
32363236
OsConfigLogHandle log = nullptr;
32373237
EXPECT_NE(nullptr, log = OpenLog(m_path, nullptr));
32383238

3239-
OsConfigLogInfo(log, "Installing the crash handler in the parent process")
3239+
OsConfigLogInfo(log, "Installing the crash handler in the parent process");
32403240
InstallCrashHandler(m_path);
32413241

3242-
OsConfigLogInfo(log, "Forking the child process that will crash")
3242+
OsConfigLogInfo(log, "Forking the child process that will crash");
32433243
pid_t pid = fork();
32443244
EXPECT_NE(-1, pid);
32453245
if (0 == pid)
32463246
{
32473247
// Cause a genuine SIGSEGV via NULL dereference exercises the full signal delivery and handler path
3248-
OsConfigLogInfo(log, "Forcing the crash")
3248+
OsConfigLogInfo(log, "Forcing the crash");
32493249
volatile int* null_ptr = NULL;
32503250
*null_ptr = 0;
32513251
_exit(0); // never reached
32523252
}
32533253
waitpid(pid, NULL, 0);
3254-
OsConfigLogInfo(log, "Done!")
3254+
OsConfigLogInfo(log, "Done!");
32553255

32563256
// Verify the crash handler [ERROR] lines appear in the handler log
32573257
char* contents = NULL;

0 commit comments

Comments
 (0)