Re: strcmp vs strncmp question

2005-11-14 Thread Theo de Raadt
Wel. had you looked at the second hit (really near the top, so boredom should not have set in yet) searching for why it was a hit you would have seen several instances of str*** func calls being replaced by strn*** func when the str ones were unsafe. Seeing that it was all about a

Re: strcmp vs strncmp question

2005-11-14 Thread Theo de Raadt
Rod.. Whitworth wrote: /* Made up example of course */ - if (!strcmp(buf,n/a)) + if (!strncmp(buf,n/a,3)) you would have seen several instances of str*** func calls being replaced by strn*** func when the str ones were unsafe. Seeing that it The one has little to do with the other.

Re: strcmp vs strncmp question

2005-11-14 Thread Peter Valchev
In the meantime, we're a few posts down the road from the original question, and I haven't seen any answer; neither on the list, nor on the Net. I suppose it has something to do with strcmp continuing to compare until it finds a char with value 0, but I can think of many situations where

Re: strcmp vs strncmp question

2005-11-14 Thread Moritz Grimm
Rod.. Whitworth wrote: /* Made up example of course */ - if (!strcmp(buf,n/a)) + if (!strncmp(buf,n/a,3)) you would have seen several instances of str*** func calls being replaced by strn*** func when the str ones were unsafe. Seeing that it The one has little to do with the other. What if

Re: strcmp vs strncmp question

2005-11-14 Thread patrick ~
--- Rod.. Whitworth [EMAIL PROTECTED] wrote: On Sun, 13 Nov 2005 17:22:42 -0800 (PST), patrick ~ wrote: /* Made up example of course */ - if (!strcmp(buf,n/a)) + if (!strncmp(buf,n/a,3)) Is there a real value in doing this? I don't see it. Can someone shed some light on this

strcmp vs strncmp question

2005-11-13 Thread patrick ~
I've been looking in some of the ports I have interest in and I have noticed a lot of changes in the patches directory where we are replacing 'strcmp' instances with 'strncmp'. e.g., /* Made up example of course */ - if (!strcmp(buf,n/a)) + if (!strncmp(buf,n/a,3)) Is there a real value

Re: strcmp vs strncmp question

2005-11-13 Thread Rod.. Whitworth
On Sun, 13 Nov 2005 17:22:42 -0800 (PST), patrick ~ wrote: I've been looking in some of the ports I have interest in and I have noticed a lot of changes in the patches directory where we are replacing 'strcmp' instances with 'strncmp'. e.g., /* Made up example of course */ - if