This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On 28.07.2016 0:35, Jon Turney wrote: > > Doing a bit of testing with this patch... > > On 26/07/2016 18:15, LRN wrote: >> + named_thread = find_thread_ptid (named_thread_ptid); > > ... it seems this may return NULL (e.g. if the thread we are naming was > short-lived and has already exited, or if the thread id was invalid) ... > >> + >> + thread_name = NULL; >> + thread_name_len = target_read_string (thread_name_target, &thread_name, 1025, 0); >> + if (thread_name_len > 0 && thread_name != NULL) >> + { >> + thread_name[thread_name_len - 1] = '\0'; >> + if (thread_name[0] != '\0') >> + { >> + xfree (named_thread->name); > > ... so this becomes a null dereference. > >> + named_thread->name = thread_name; >> + } >> + else >> + { >> + xfree (thread_name); >> + } > True. The simplest fix for this is to turn the check > thread_name[0] != '\0' into > thread_name[0] != '\0' && named_thread != NULL -- O< ascii ribbon - stop html email! - www.asciiribbon.org
Attachment:
0x6759BA74.asc
Description: application/pgp-keys
Attachment:
signature.asc
Description: OpenPGP digital signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |