This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [COMMIT] Don't use strcpy and strcat in main.c
- From: "Eli Zaretskii" <eliz at gnu dot org>
- To: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- Cc: gdb-patches at sourceware dot org
- Date: Sun, 03 Apr 2005 06:25:36 +0300
- Subject: Re: [COMMIT] Don't use strcpy and strcat in main.c
- References: <200504022025.j32KPRm6014345@elgar.sibelius.xs4all.nl>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> Date: Sat, 2 Apr 2005 22:25:27 +0200 (CEST)
> From: Mark Kettenis <mark.kettenis@xs4all.nl>
>
> Index: ChangeLog
> from Mark Kettenis <kettenis@gnu.org>
>
> * main.c: Update copyright year.
> (captured_main): Avois using strcpy and strcat.
^^^^^
A typo.
> - homeinit = (char *) alloca (strlen (homedir) +
> - strlen (gdbinit) + 10);
> - strcpy (homeinit, homedir);
> - strcat (homeinit, "/");
> - strcat (homeinit, gdbinit);
> + char *homeinit = xstrprintf ("%s/%s", homedir, gdbinit);
Why was the original code unworthy? because it used alloca?