From 010ece9c47f1ac08c9436b133a74472713dd709b Mon Sep 17 00:00:00 2001 From: Luis Machado Date: Mon, 24 Oct 2016 17:44:56 -0500 Subject: Fix obvious gotcha in string comparison This patch fixes a gotcha when comparing exception's messages in exception_print_same. It should've used the statically-allocated string versions msg1 and msg2 instead. As is, it could lead to crashes. gdb/ChangeLog: 2016-10-24 Luis Machado * exec.c (exception_print_same): Fix string comparison to use statically-allocated ones. --- gdb/exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gdb/exec.c') diff --git a/gdb/exec.c b/gdb/exec.c index d858e99..67ecc63 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -152,7 +152,7 @@ exception_print_same (struct gdb_exception e1, struct gdb_exception e2) return (e1.reason == e2.reason && e1.error == e2.error - && strcmp (e1.message, e2.message) == 0); + && strcmp (msg1, msg2) == 0); } /* See gdbcore.h. */ -- cgit v1.1