From eac87979dc914911b62db6fe661eb772bf306ed4 Mon Sep 17 00:00:00 2001 From: Hieu Van Nguyen Date: Thu, 9 Oct 2025 11:34:43 +0900 Subject: [PATCH] dbus-uuidgen: Enable stack memory protection Use "return" instead of "exit()" at the end of the main() function to enable runtime stack overflow checks. Using "return" allows the program to exit normally from main(), letting the compiler perform necessary cleanup operations, including stack canary verification. When using "exit()" at the end of main(), the __stack_chk_fail function is not invoked. $ objdump -T ./util/.libs/mtp-hotplug | grep __stack_chk_fail (This returns empty.) Signed-off-by: Hieu Nguyen --- tools/dbus-uuidgen.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/dbus-uuidgen.c b/tools/dbus-uuidgen.c index e20f48aa..c98ce856 100644 --- a/tools/dbus-uuidgen.c +++ b/tools/dbus-uuidgen.c @@ -125,7 +125,7 @@ main (int argc, char *argv[]) if (get_uuid && ensure_uuid) { fprintf (stderr, "Can't specify both --get and --ensure\n"); - exit (1); + return 1; } dbus_error_init (&error); @@ -155,10 +155,10 @@ main (int argc, char *argv[]) { fprintf (stderr, "%s\n", error.message); dbus_error_free (&error); - exit (1); + return 1; } else { - exit (0); + return 0; } }