On 6 Dec 2012, at 14:14, Igor Tandetnik wrote:

> Your code assumes, in several places, that strings passed to collation 
> function are NUL-terminated. They don't have to be - that's why lengths are 
> also passed. I think this may be causing the problem you are seeing: when the 
> string comes from a literal (as in x < '' ) it just may happen to be 
> NUL-terminated, but when it comes straight from the database, it may not be, 
> and you are cheerfully reading garbage past the end of buffer.

        Thanks for your analysis and helpful comments.

        I'll need to take care to make a NUL-terminated copy of each source 
string,
        as inet_pton doesn't take a count argument.

> Your test program, of course, always happens to pass NUL-terminated strings.

        Doh! 8-)

        /Niall

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to