<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40415 >
> [EMAIL PROTECTED] - Sun Aug 03 21:13:54 2008]: > > Good catch. But why need strncmp at all? The string is always > null-terminated, is it not? Then strcmp will work just fine. True, it is very unlikely that both pcity->name and packet->name would have no terminating nulls, and even if both did not, then at worst it would result in strcmp reading past the end of the memory for those struct fields, possibly past the end of the memory for 'pcity' or 'packet' if there are no null bytes before the end (incredibly unlikely). So while the danger is rather minor, using strncmp at least does not assume that programmers will always remember to null-terminate those strings (or that this condition could not arise by some other freak of nature). ----------------------------------------------------------------------- 弁護士なら、なんとか証拠を見つけますよ。 _______________________________________________ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev