[GRASS5] str*() vs strn*() functions

Paul Kelly paul-grass at stjohnspoint.co.uk
Fri Aug 26 05:18:40 EDT 2005

Hello Brad

On Fri, 26 Aug 2005, Brad Douglas wrote:

> Is there any particular reason there has been a recent move from using
> strn*() function to using str*() functions?

It was a bugfix: with strncmp it was returning a match if one string was 
shorter than the other but matched the first n characters. We needed to 
match the whole string.

> Specifying the string length has security benefits.

What is the problem with using strcmp specifically?
I had a think about it and couldn't think of any reason not to use strcmp(), 
so I changed some occurences of strncmp() I had added in the past (blindly 
following the way it was done in other parts of the proj library).


More information about the grass-dev mailing list