[softwarelist] Re: Bookmark names - OPro RO

  • From: David Pilling <flist@xxxxxxxxxxxxxxxxxxx>
  • To: davidpilling@xxxxxxxxxxxxx
  • Date: Mon, 22 Aug 2011 18:54:19 +0100

Hi,

In message <4E528D7C.5070705@xxxxxxxxxxxxxx>, Tony van der Hoff <tony@xxxxxxxxxxxxxx> writes
Hum. That's what strncpy() is for. memset() the destination to null first. No need for slapdashery due to the language; only the programmer.

So two functions which I'll package up as one, so its like I've got to write my own function and then is memset'ing the lot efficient, probably not so I'll replace that.

As I said for myself and for Windows latterly along came functions that do strcpy() properly. ISTR there's a MS document circa 2004 where they invent a whole set of string functions that don't overrun buffers.

Everyone meeting strcpy() for the first time can see what is wrong with it, but do they have the opportunity and skill to code a replacement.

The only thing is that circa K&R 1970 odd no one thought that strcpy() would be used to spread virus's.

It is not the language its the way it is explained.


--
David Pilling
email: david@xxxxxxxxxxxxxxxxxxx
  web: http://www.davidpilling.net
 post: David Pilling, P.O. Box 22, Thornton-Cleveleys, Blackpool. FY5 1LR. UK
To unsubscribe or subscribe goto: //www.freelists.org/list/davidpilling

Other related posts: