Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
UserAdminV2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
庄欣
UserAdminV2
Commits
c878a18f
Commit
c878a18f
authored
May 13, 2013
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1962 from fpirsch/master
fix incorrect padding with multibyte strings encryption
parents
5d63d5ad
76db2065
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
15 deletions
+3
-15
laravel/crypter.php
+3
-15
No files found.
laravel/crypter.php
View file @
c878a18f
...
@@ -116,7 +116,7 @@ class Crypter {
...
@@ -116,7 +116,7 @@ class Crypter {
*/
*/
protected
static
function
pad
(
$value
)
protected
static
function
pad
(
$value
)
{
{
$pad
=
static
::
$block
-
(
Str
::
length
(
$value
)
%
static
::
$block
);
$pad
=
static
::
$block
-
(
strlen
(
$value
)
%
static
::
$block
);
return
$value
.=
str_repeat
(
chr
(
$pad
),
$pad
);
return
$value
.=
str_repeat
(
chr
(
$pad
),
$pad
);
}
}
...
@@ -129,14 +129,7 @@ class Crypter {
...
@@ -129,14 +129,7 @@ class Crypter {
*/
*/
protected
static
function
unpad
(
$value
)
protected
static
function
unpad
(
$value
)
{
{
if
(
MB_STRING
)
$pad
=
ord
(
substr
(
$value
,
-
1
));
{
$pad
=
ord
(
mb_substr
(
$value
,
-
1
,
1
,
Config
::
get
(
'application.encoding'
)));
}
else
{
$pad
=
ord
(
substr
(
$value
,
-
1
));
}
if
(
$pad
and
$pad
<=
static
::
$block
)
if
(
$pad
and
$pad
<=
static
::
$block
)
{
{
...
@@ -145,12 +138,7 @@ class Crypter {
...
@@ -145,12 +138,7 @@ class Crypter {
// as the padding appears to have been changed.
// as the padding appears to have been changed.
if
(
preg_match
(
'/'
.
chr
(
$pad
)
.
'{'
.
$pad
.
'}$/'
,
$value
))
if
(
preg_match
(
'/'
.
chr
(
$pad
)
.
'{'
.
$pad
.
'}$/'
,
$value
))
{
{
if
(
MB_STRING
)
return
substr
(
$value
,
0
,
strlen
(
$value
)
-
$pad
);
{
return
mb_substr
(
$value
,
0
,
Str
::
length
(
$value
)
-
$pad
,
Config
::
get
(
'application.encoding'
));
}
return
substr
(
$value
,
0
,
Str
::
length
(
$value
)
-
$pad
);
}
}
// If the padding characters do not match the expected padding
// If the padding characters do not match the expected padding
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment