Advertisement
Guest User

Untitled

a guest
Jun 21st, 2013
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. 31
  2. There are several potential problems with this code.
  3. First, it assumes a tty environment. That may be fine if
  4. the assumption is true, but what if this code is called
  5. from a GUI environment where neither stderr nor
  6. stdin is open ?
  7. Second, there is the problematic gets, which will write
  8. as many characters as it receives into the buffer
  9. passed in. Malicious users have used this failing to
  10. create buffer overrun security holes in many different
  11. systems. Never use gets().
  12. Third, the code assumes the user understands English.
  13. Finally, no one in their right mind would ever bury user
  14. interaction such as this in a library routine
  15.  
  16. 32
  17. POSIX strcpy isn't guaranteed to work for
  18. overlapping strings. It might happen to work on some
  19. architectures, but only by coincidence
  20.  
  21. 33
  22. It won't work in an applet context with security
  23. restrictions against writing to the local disk. Again,
  24. when you have a choice of running in GUI contexts or
  25. not, you may want to check dynamically to see what
  26. the current environment is like. In this case, you may
  27. want to put a log file somewhere other than the local
  28. disk if it isn't accessible.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement