Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2001:
[Freeciv-Dev] Re: Fwd: Re: Re: Request (PR#939)
Home

[Freeciv-Dev] Re: Fwd: Re: Re: Request (PR#939)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: rf13@xxxxxxxxxxxxxxxxxxxxxx
Cc: Trent Piepho <xyzzy@xxxxxxxxxxxxx>, Paul Zastoupil <paulz@xxxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Fwd: Re: Re: Request (PR#939)
From: Paul Zastoupil <paulz@xxxxxxxxxxxx>
Date: Fri, 7 Sep 2001 09:45:40 -0700

On Fri, Sep 07, 2001 at 09:51:19AM +0200, Raimar Falke wrote:
> On Thu, Sep 06, 2001 at 10:30:31PM -0700, Trent Piepho wrote:
> > On Thu, 6 Sep 2001, Paul Zastoupil wrote:
> > > > 
> > > > Why is it that you need to copy the string at all?  What's wrong with
> > > > this?
> > > > 
> > > > static void wall(char *str) 
> > > > { 
> > > >   notify_conn_ex(&game.game_connections,-1,-1,E_MESSAGE_WALL, 
> > > >                  _("Server Operator: %s"),str); 
> > > > }
> > > 
> > > Well, I guess because we don't know that str is safe?
> > 
> > What do you mean, "safe"?  It's limited to the MAX_LEN_CMD.  I think you can
> > assume that a function that takes a C string as an argument will get a C
> > string.
> 
> $ grep -Ir MAX_LEN_CMD .
> ./ChangeLog:    MAX_CMD_LEN        -> MAX_LEN_CMD
> $ grep -Ir MAX_CMD_LEN .
> ./ChangeLog:    MAX_CMD_LEN        -> MAX_LEN_CMD
> 
>       Raimar

./server/console.h:#define MAX_LEN_CONSOLE_LINE 512
./server/stdinhand.c:  char command[MAX_LEN_CONSOLE_LINE], 
arg[MAX_LEN_CONSOLE_LINE], *cptr_s, *cptr_d;
This has an interesting effect.  If you enter a line over 512, you can't hit 
enter :)

So str is safe.

New one attached.

-- 
Paul Zastoupil

Attachment: anotherwall.diff
Description: Text document


[Prev in Thread] Current Thread [Next in Thread]