From fecfd56e46ad3bc2982feb9526470f6c6ec493be Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Mon, 9 Feb 2009 19:20:40 +0000 Subject: [PATCH] =?utf8?q?Bug=20477513:=20md5=5Fhex()=20fails=20if=20a=20s?= =?utf8?q?aved=20search=20has=20UTF8=20characters=20in=20it=20-=20Patch=20?= =?utf8?q?by=20Fr=C3=83=C2=A9d=C3=83=C2=A9ric=20Buclin=20=20r=3Dmkanat=20a=3DLpSolit?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Bugzilla/Token.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Bugzilla/Token.pm b/Bugzilla/Token.pm index a54da4af59..a8862bd5a4 100644 --- a/Bugzilla/Token.pm +++ b/Bugzilla/Token.pm @@ -181,7 +181,13 @@ sub issue_hash_token { # The concatenated string is of the form # token creation time + site-wide secret + user ID + data my @args = ($time, Bugzilla->localconfig->{'site_wide_secret'}, Bugzilla->user->id, @$data); - my $token = md5_hex(join('*', @args)); + + my $token = join('*', @args); + # Wide characters cause md5_hex() to die. + if (Bugzilla->params->{'utf8'}) { + utf8::encode($token) if utf8::is_utf8($token); + } + $token = md5_hex($token); # Prepend the token creation time, unencrypted, so that the token # lifetime can be validated. -- 2.47.2