Multibyte bug in hba.c regular expression processing

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: Multibyte bug in hba.c regular expression processing
Date: 2013-07-31 13:58:36
Message-ID: 11727.1375279116@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2013-07-31 14:17:00 Re: REGEXP_MATCHES() strange behavior with '^' and '$' pattern
Previous Message Fujii Masao 2013-07-31 13:55:38 Re: Small comment fix in sinvaladt.c