Fix obvious gotcha in string comparison
authorLuis Machado <lgustavo@codesourcery.com>
Mon, 24 Oct 2016 22:44:56 +0000 (17:44 -0500)
committerLuis Machado <lgustavo@codesourcery.com>
Mon, 24 Oct 2016 22:44:56 +0000 (17:44 -0500)
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  <lgustavo@codesourcery.com>

* exec.c (exception_print_same): Fix string comparison to use
statically-allocated ones.

gdb/ChangeLog
gdb/exec.c

index be72369adb812a2a1ed55697d22d85f02228bc51..388cc1ff61fbfbf0978d6cd23457fcff40ed0c48 100644 (file)
@@ -1,3 +1,8 @@
+2016-10-24  Luis Machado  <lgustavo@codesourcery.com>
+
+       * exec.c (exception_print_same): Fix string comparison to use
+       statically-allocated ones.
+
 2016-10-21  Tom Tromey  <tom@tromey.com>
 
        * dwarf2expr.h (class dwarf_expr_context)
index d858e996a8de69038b4f39b2572d1753ab0df551..67ecc6363072cdd7b8b00aaa36085b7c2ccf032f 100644 (file)
@@ -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.  */
This page took 0.029633 seconds and 4 git commands to generate.