> -----Original Message-----
> From: Rui Silva - Webmaster [mailto:[EMAIL PROTECTED]]
> Subject: Re: ANSI standards
>
>  if you try to compare a string with someother and at least one
> of them is not null terminated, you might have unexpected results.
>
> there are 2 approaches:
>  a) be sure that all of the arguments are clean before calling
>  b) compare only so many characters.
>
> that was what I was saying. strdup has that problem and anybody
> using strdup is encoraged to use strndup for safety reasons.
> since I am very careul with my strings, I haven't checket what
> happened, but maybe something wich was not desired.
>

Ah!  I see what you mean.  Is there any way around it though?  If I check
the length of the string, either by using strlen(), or a routine of my own
making, won't it break on non-null-terminated strings too (the only way I
can see of doing it is to loop through the string until I find a NULL)?

> if there's no problem, great... I am totally in favour regarding
> simplification of code :) but one must not forget stability.

I totally agree with this.  Perhaps I'm missing something obvious here - I
think I need to go to bed :-)

Jamie.






Reply via email to