On Thu, 27 Oct 2005, John N. Brahy wrote: > First of all, it's been a while since I've written c, so I'm curious if > this is a bulk change I can do. > > > > I'm changing code that another programmer did, but we got rid of him for > doing stupid things. So I'm auditing his source code on a few of our > customer's sites and I came across a strcat. And when I recompile it, I > got warnings saying that it's almost always misused, then I read the > manpage of strlcat and it seemed simple enough to do this: > > > > strcat(mailbox, MAILSPOOLHOME); > > strlcat(mailbox, MAILSPOOLHOME, sizeof(mailbox)); > > > > Should I look out for anything special or is it safe to do this > everywhere I see strcat or strcpy?
No, you should understand what you are doing. Depending if mailbox is declared as an array with known size or a pointer, this will work as expected or not. -Otto