When remote target returns some invalid signal, gdb vill crash with
segfault. The problem seems to be in function target_signal_to_name,
which doesn't check, if signal is in bounds and returns invalid name.

This version will (at least) not segfault:

/* Return the name for a signal.  */
char *
target_signal_to_name (sig)
     enum target_signal sig;
{
  if (sig == TARGET_SIGNAL_UNKNOWN)
    /* I think the code which prints this will always print it along with
       the string, so no need to be verbose.  */
    return "?";
  if ((sig >= TARGET_SIGNAL_FIRST) && (sig <= TARGET_SIGNAL_LAST))
    return signals[sig].name;
  else
    return signals[TARGET_SIGNAL_UNKNOWN].name;
}


Petr Ledvina
[EMAIL PROTECTED]


_______________________________________________
Bug-gdb mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-gdb

Reply via email to