mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-08-06 06:45:56 +08:00
Fix potential NULL pointer dereference
This patch addresses a potential NULL pointer dereference when we try to duplicate a string. The input pointer can be NULL and that may lead to crashes. We simply add a check for that case. gdb/ChangeLog: 2016-10-24 Luis Machado <lgustavo@codesourcery.com> * exec.c (exec_file_locate_attach): Prevent NULL pointer dereference when duplicating a string.
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2016-10-24 Luis Machado <lgustavo@codesourcery.com>
|
||||||
|
|
||||||
|
* exec.c (exec_file_locate_attach): Prevent NULL pointer dereference
|
||||||
|
when duplicating a string.
|
||||||
|
|
||||||
2016-10-24 Luis Machado <lgustavo@codesourcery.com>
|
2016-10-24 Luis Machado <lgustavo@codesourcery.com>
|
||||||
|
|
||||||
* exec.c (exception_print_same): Fix string comparison to use
|
* exec.c (exception_print_same): Fix string comparison to use
|
||||||
|
@ -227,7 +227,8 @@ exec_file_locate_attach (int pid, int defer_bp_reset, int from_tty)
|
|||||||
prev_err = err;
|
prev_err = err;
|
||||||
|
|
||||||
/* Save message so it doesn't get trashed by the catch below. */
|
/* Save message so it doesn't get trashed by the catch below. */
|
||||||
prev_err.message = xstrdup (err.message);
|
if (err.message != NULL)
|
||||||
|
prev_err.message = xstrdup (err.message);
|
||||||
}
|
}
|
||||||
END_CATCH
|
END_CATCH
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user