This is the mail archive of the gdb-patches@sources.redhat.com 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]

Re: [COMMIT] Don't use strcpy and strcat in main.c


> 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?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]