safe_strcpy is unsafe

Michael Stockman pgmtekn-micke at algonet.se
Wed Jan 19 19:22:14 GMT 2000


Hello,

safe_strcpy is not very safe. It seems that it writes 1 char longer
than maxlen, which is bad if the buffer isn't that long. Example of
bad but common usage:

pstring str;
safe_strcpy( str, "Hello world", sizeof(str) );

This may cause a SIGSEGV!

Best regards
  Michael Stockman
  pgmtekn-micke at algonet.se





More information about the samba-technical mailing list