[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.GSO.4.44.0310261623320.12557-100000@saga10.Stanford.EDU>
From: tedu at stanford.edu (Ted Unangst)
Subject: [inbox] Re: RE: Linux (in)security
On Mon, 27 Oct 2003, Brett Hutley wrote:
> char buf[10];
> const char *str1 = "OVER";
> const char *str2 = "FLOW!!!!!";
> sprintf(buf, "%s%s", str1, str2);
>
> Admittedly a contrived example. The best way to handle this type of
> stuff is to provide "safe" functions - like a sprintfn() that takes the
> maximum size of the buffer to write into as an argument. This function
> is reasonably tricky to write however. Consider the following example:
erm, snprintf? the reasonably tricky to implement part is kinda true,
there are/were many implementations which didn't do the right thing, but i
think that's improved.
--
"I am making this trip to Africa because Washington is an international
city, just like Tokyo, Nigeria or Israel. As mayor, I am an
international symbol. Can you deny that to Africa?"
- M. Barry, Mayor of Washington, DC
Powered by blists - more mailing lists