This is the mail archive of the
mailing list for the GDB project.
Re: sim/arm/armos.c: IsTTY [PATCH]
- From: Richard Earnshaw <rearnsha at gcc dot gnu dot org>
- To: sjackman at gmail dot com
- Cc: gdb-patches at sources dot redhat dot com
- Date: Thu, 08 Sep 2005 10:06:28 +0100
- Subject: Re: sim/arm/armos.c: IsTTY [PATCH]
- References: <email@example.com> <20050830023718.GB16189@nevyn.them.org> <firstname.lastname@example.org>
On Wed, 2005-09-07 at 17:51, Shaun Jackman wrote:
> 2005/8/29, Daniel Jacobowitz <email@example.com>:
> > Please no buffer overflows be adding. Also, there's plenty of ways to
> > write this without the ugly empty loop body...
> I fixed the potential buffer overflow and cleaned up the loop coding
> style. Thanks for the tips.
> 2005-09-07 Shaun Jackman <firstname.lastname@example.org>
> * sim/arm/armos.c (unlink): Remove this macro. It is unused
> in this file and conflicts with sim_callback->unlink.
> (SWIopen): Fix a potential buffer overflow.
> (SWIremove): New function.
> (SWIrename): Ditto.
> (ARMul_OSHandleSWI): Handle the RDP calls SWI_IsTTY,
> SWI_Remove, and SWI_Rename, as well as the RDI calls
> AngelSWI_Reason_IsTTY, AngelSWI_Reason_Remove, and
Two problems I can immediately see with this.
1) PATH_MAX isn't ANSI (it's POSIX, or something like that). So you
can't rely on it being defined. I think for this case you can probably
just define it to 1024 anyway if it's missing, but see
libiberty/lrealpath.c if you want the gory details.
2) If you do overflow the path limit, you need to set the simulator's
errno value and return. Use cb_host_to_target_errno(sim_callback,
ENAMETOOLONG) to set it.