[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [or-cvs] betcha didn"t know strncpy could leave an unterminatedstring



Roger Dingledine wrote:

Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or

Modified Files:
dirserv.c dns.c Log Message:
betcha didn't know strncpy could leave an unterminated string
Did actually - that's why you should use strlcpy and strlcat instead. Another thing that's bad about strncpy is it NUL _fills_ which can be a significant cost if you use large buffers.

Cheers,

Ben.

--
http://www.apache-ssl.org/ben.html http://www.thebunker.net/

"There is no limit to what a man can do or how far he can go if he
doesn't mind who gets the credit." - Robert Woodruff