TIP: Click on subject to list as thread! ANSI
echo: nthelp
to: Geo
from: Tony Williams
date: 2004-10-23 09:16:22
subject: Re: Organizing source code

From: Tony Williams 

Geo wrote:
> "John Beckett" 
wrote in message
> news:417a21b4.28158369{at}216.144.1.254...
>
>
>>I confess that I gave up on cout some time ago. I tried a couple of times
>>to break my old "printf" habits,
>
>
> There have been a number of exploits because people used printf, one of the
> reasons I'm taking this class is so I can understand why and what the
> difference is between cout and printf.

Usually it's someone using sprintf to format a string in memory. The simple
rule is to always use snprintf which makes you put an upper bound on the
number of bytes to be written - buffer overflows can't happen then. Most of
the string functions have a similar "n" version - strncpy,
strncat and so on.

We have a rule forbidding the use of non-bounded string functions and it
makes for much more reliable code.

--
Tony

--- BBBS/NT v4.01 Flag-5
* Origin: Barktopia BBS Site http://HarborWebs.com:8081 (1:379/45)
SEEN-BY: 633/267 270 5030/786
@PATH: 379/45 1 396/45 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.