diff options
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/ada-tasks.c | 3 | ||||
-rw-r--r-- | gdb/linux-tdep.c | 4 |
3 files changed, 10 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f1b007b..583ec9c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2020-03-20 Tom Tromey <tromey@adacore.com> + * ada-tasks.c (read_atcb): Use smaller length in strncpy call. + * linux-tdep.c (linux_fill_prpsinfo): Use smaller length in + strncpy call. + +2020-03-20 Tom Tromey <tromey@adacore.com> + * symmisc.c (maintenance_print_one_line_table): Use ui_out. 2020-03-20 Tom Tromey <tromey@adacore.com> diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c index 0a81c3c..589d5e8 100644 --- a/gdb/ada-tasks.c +++ b/gdb/ada-tasks.c @@ -679,7 +679,8 @@ read_atcb (CORE_ADDR task_id, struct ada_task_info *task_info) task_name = p + 2; /* Copy the task name. */ - strncpy (task_info->name, task_name, sizeof (task_info->name)); + strncpy (task_info->name, task_name, + sizeof (task_info->name) - 1); task_info->name[sizeof (task_info->name) - 1] = 0; } else diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c index b6374ce..e50946c 100644 --- a/gdb/linux-tdep.c +++ b/gdb/linux-tdep.c @@ -1729,7 +1729,7 @@ linux_fill_prpsinfo (struct elf_internal_linux_prpsinfo *p) /* Copying the program name. Only the basename matters. */ basename = lbasename (fname.get ()); - strncpy (p->pr_fname, basename, sizeof (p->pr_fname)); + strncpy (p->pr_fname, basename, sizeof (p->pr_fname) - 1); p->pr_fname[sizeof (p->pr_fname) - 1] = '\0'; infargs = get_inferior_args (); @@ -1739,7 +1739,7 @@ linux_fill_prpsinfo (struct elf_internal_linux_prpsinfo *p) if (infargs != NULL) psargs = psargs + " " + infargs; - strncpy (p->pr_psargs, psargs.c_str (), sizeof (p->pr_psargs)); + strncpy (p->pr_psargs, psargs.c_str (), sizeof (p->pr_psargs) - 1); p->pr_psargs[sizeof (p->pr_psargs) - 1] = '\0'; xsnprintf (filename, sizeof (filename), "/proc/%d/stat", (int) pid); |