Thread: Multibyte bug in hba.c regular expression processing

Multibyte bug in hba.c regular expression processing

From
Tom Lane
Date:
It appears to me that check_ident_usermap() will substitute incorrectly
for \1 if the user name contains any multibyte characters, because
it supposes that the "rm_so" and "rm_eo" numbers returned by pg_regexec()
are byte offsets, when in reality they are character offsets.

Correct code for this would need to use charlen_to_bytelen() to navigate
the string to the proper places, as is done in replace_text_regexp() for
example.

I'm not terribly excited about fixing this myself, but perhaps someone
else would like to.
        regards, tom lane