And various vendor-specific strcpy() etc. clones that pass an explicit length 
and don't have the gotcha of strncpy().

Not to mention a modest enhancement to C called C++, with its STL, including a 
character string type that is truly of (safe) unlimited length.

Charles

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf 
Of Paul Gilmartin
Sent: Friday, June 28, 2013 3:27 PM
To: [email protected]
Subject: Re: Theology question: Parameter formats

On Fri, 28 Jun 2013 17:04:51 -0400, John Gilmore wrote:

>The elephant in the room is being studiously ignored.
> 
Me?

>The crucial objection to C's nul-delimited strings of 'conceptually 
>unlimited' length has so far gone unmentioned here.  They have been the 
>all but exclusive foci of security breaches, thousands of them, of 
>systems written in C/C++ and their dialects.
> 
You have, in the past, deprecated "nanny languages", those which enforce 
compile time or run time validity constraints.  Yet Wheeler is praising Pascal 
for so protecting against security breaches.

It's as easy in C as in assembler to check for buffer overrun (and easier in 
both cases not to check; damn the consequences).  C provides safer versions for 
many standard library functions:

o instead of strcpy(),  strncpy()
o instead of strcat(),  strncat()
o instead of strcmp(),  strncmp()
o instead of sprintf(), snprintf()
o instead of gets(),    fgets()
etc.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to