Multibyte bug in hba.c regular expression processing - Mailing list pgsql-hackers

From Tom Lane
Subject Multibyte bug in hba.c regular expression processing
Date
Msg-id 11727.1375279116@sss.pgh.pa.us
Whole thread Raw
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: Small comment fix in sinvaladt.c
Next
From: Tom Lane
Date:
Subject: Re: REGEXP_MATCHES() strange behavior with '^' and '$' pattern