"Maksim Likharev" <mlikharev@aurigin.com> writes:
> ! I would say very interesting aproach,
> ! why not just
> xfrmsize = strxfrm(xfrmstr, NULL, 0);
strxfrm doesn't work that way (and if it did, it would give back a
malloc'd not a palloc'd string).
> !if error happend, xfrmlen will be (size_t)-1
No it won't; see the man page for strxfrm.
This does raise an interesting thought though: what platform are you on?
It seems to me that we've heard of buggy versions of strxfrm that write
more bytes than they're allowed to, thereby clobbering palloc's data
structures.
regards, tom lane