home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / std / c / 3268 < prev    next >
Encoding:
Internet Message Format  |  1992-12-24  |  1.6 KB

  1. Path: sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!ira.uka.de!Germany.EU.net!mikros!mwtech!martin
  2. From: martin@mwtech.UUCP (Martin Weitzel)
  3. Newsgroups: comp.std.c
  4. Subject: Banning the use of `gets' (was Re: definition of strNcpy)
  5. Message-ID: <1369@mwtech.UUCP>
  6. Date: 24 Dec 92 12:04:58 GMT
  7. References: <1992Dec18.015228.6094@dms.agames.com> <1992Dec18.180358.24428@dms.agames.com> <BzMGp3.Hwr@math.uwaterloo.ca> <BzMzqC.n0u@jrd.dec.com>
  8. Reply-To: martin@mwtech.UUCP (Martin Weitzel)
  9. Organization: MIKROS Systemware, Darmstadt/W-Germany
  10. Lines: 18
  11.  
  12. In article <BzMzqC.n0u@jrd.dec.com> diamond@jit.dec.com (Norman Diamond) writes:
  13. >Remember, a language with gets() and other such niceties is intended for
  14. >hacking, not for security.  The "N" is intended to bring over a known portion
  15. >of the source string, not to protect other stuff near the target.  Now this
  16. >raises the question of why memcpy() was invented, and I don't know the answer.
  17. >
  18. >On a more serious note, people actually do use gets().  I'd worry about this
  19. >kind of dangerous stuff long before caring about silly things like strncat().
  20.  
  21. I think Norman made a very good point here.  If in your C-library `gets'
  22. is a single module (I just checked and at least in UNIX SysV.R3 it seems
  23. to be so) you have a choice:  Pull this module out of the library and
  24. into a new one (say, "/lib/libdangerous.l").  So programs using gets
  25. will have an `unresolvable external'.  This should help to alert people
  26. that they should change their programs.  (And if they are desperate they
  27. can still link the programs by adding "-ldangerous" to the cc command line.)
  28. -- 
  29. Martin Weitzel, email: martin@mwtech.UUCP, voice: 49-(0)6151-6 56 83
  30.