Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
f64d6004
Commit
f64d6004
authored
Nov 01, 2007
by
Juan Lang
Committed by
Alexandre Julliard
Nov 02, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Don't leak buffer when a unicode string contains an invalid character.
parent
b9e78cc6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
15 deletions
+30
-15
encode.c
dlls/crypt32/encode.c
+30
-15
No files found.
dlls/crypt32/encode.c
View file @
f64d6004
...
@@ -1579,16 +1579,19 @@ static BOOL CRYPT_AsnEncodeNumericString(const CERT_NAME_VALUE *value,
...
@@ -1579,16 +1579,19 @@ static BOOL CRYPT_AsnEncodeNumericString(const CERT_NAME_VALUE *value,
pbEncoded
,
pcbEncoded
,
bytesNeeded
)))
pbEncoded
,
pcbEncoded
,
bytesNeeded
)))
{
{
DWORD
i
;
DWORD
i
;
BYTE
*
ptr
;
if
(
dwFlags
&
CRYPT_ENCODE_ALLOC_FLAG
)
if
(
dwFlags
&
CRYPT_ENCODE_ALLOC_FLAG
)
pbEncoded
=
*
(
BYTE
**
)
pbEncoded
;
ptr
=
*
(
BYTE
**
)
pbEncoded
;
*
pbEncoded
++
=
ASN_NUMERICSTRING
;
else
CRYPT_EncodeLen
(
encodedLen
,
pbEncoded
,
&
lenBytes
);
ptr
=
pbEncoded
;
pbEncoded
+=
lenBytes
;
*
ptr
++
=
ASN_NUMERICSTRING
;
CRYPT_EncodeLen
(
encodedLen
,
ptr
,
&
lenBytes
);
ptr
+=
lenBytes
;
for
(
i
=
0
;
ret
&&
i
<
encodedLen
;
i
++
)
for
(
i
=
0
;
ret
&&
i
<
encodedLen
;
i
++
)
{
{
if
(
isdigitW
(
str
[
i
]))
if
(
isdigitW
(
str
[
i
]))
*
p
bEncoded
++
=
(
BYTE
)
str
[
i
];
*
p
tr
++
=
(
BYTE
)
str
[
i
];
else
else
{
{
*
pcbEncoded
=
i
;
*
pcbEncoded
=
i
;
...
@@ -1596,6 +1599,8 @@ static BOOL CRYPT_AsnEncodeNumericString(const CERT_NAME_VALUE *value,
...
@@ -1596,6 +1599,8 @@ static BOOL CRYPT_AsnEncodeNumericString(const CERT_NAME_VALUE *value,
ret
=
FALSE
;
ret
=
FALSE
;
}
}
}
}
if
(
!
ret
&&
(
dwFlags
&
CRYPT_ENCODE_ALLOC_FLAG
))
CryptMemFree
(
*
(
BYTE
**
)
pbEncoded
);
}
}
}
}
return
ret
;
return
ret
;
...
@@ -1628,16 +1633,19 @@ static BOOL CRYPT_AsnEncodePrintableString(const CERT_NAME_VALUE *value,
...
@@ -1628,16 +1633,19 @@ static BOOL CRYPT_AsnEncodePrintableString(const CERT_NAME_VALUE *value,
pbEncoded
,
pcbEncoded
,
bytesNeeded
)))
pbEncoded
,
pcbEncoded
,
bytesNeeded
)))
{
{
DWORD
i
;
DWORD
i
;
BYTE
*
ptr
;
if
(
dwFlags
&
CRYPT_ENCODE_ALLOC_FLAG
)
if
(
dwFlags
&
CRYPT_ENCODE_ALLOC_FLAG
)
pbEncoded
=
*
(
BYTE
**
)
pbEncoded
;
ptr
=
*
(
BYTE
**
)
pbEncoded
;
*
pbEncoded
++
=
ASN_PRINTABLESTRING
;
else
CRYPT_EncodeLen
(
encodedLen
,
pbEncoded
,
&
lenBytes
);
ptr
=
pbEncoded
;
pbEncoded
+=
lenBytes
;
*
ptr
++
=
ASN_PRINTABLESTRING
;
CRYPT_EncodeLen
(
encodedLen
,
ptr
,
&
lenBytes
);
ptr
+=
lenBytes
;
for
(
i
=
0
;
ret
&&
i
<
encodedLen
;
i
++
)
for
(
i
=
0
;
ret
&&
i
<
encodedLen
;
i
++
)
{
{
if
(
isprintableW
(
str
[
i
]))
if
(
isprintableW
(
str
[
i
]))
*
p
bEncoded
++
=
(
BYTE
)
str
[
i
];
*
p
tr
++
=
(
BYTE
)
str
[
i
];
else
else
{
{
*
pcbEncoded
=
i
;
*
pcbEncoded
=
i
;
...
@@ -1645,6 +1653,8 @@ static BOOL CRYPT_AsnEncodePrintableString(const CERT_NAME_VALUE *value,
...
@@ -1645,6 +1653,8 @@ static BOOL CRYPT_AsnEncodePrintableString(const CERT_NAME_VALUE *value,
ret
=
FALSE
;
ret
=
FALSE
;
}
}
}
}
if
(
!
ret
&&
(
dwFlags
&
CRYPT_ENCODE_ALLOC_FLAG
))
CryptMemFree
(
*
(
BYTE
**
)
pbEncoded
);
}
}
}
}
return
ret
;
return
ret
;
...
@@ -1670,16 +1680,19 @@ static BOOL CRYPT_AsnEncodeIA5String(const CERT_NAME_VALUE *value,
...
@@ -1670,16 +1680,19 @@ static BOOL CRYPT_AsnEncodeIA5String(const CERT_NAME_VALUE *value,
pbEncoded
,
pcbEncoded
,
bytesNeeded
)))
pbEncoded
,
pcbEncoded
,
bytesNeeded
)))
{
{
DWORD
i
;
DWORD
i
;
BYTE
*
ptr
;
if
(
dwFlags
&
CRYPT_ENCODE_ALLOC_FLAG
)
if
(
dwFlags
&
CRYPT_ENCODE_ALLOC_FLAG
)
pbEncoded
=
*
(
BYTE
**
)
pbEncoded
;
ptr
=
*
(
BYTE
**
)
pbEncoded
;
*
pbEncoded
++
=
ASN_IA5STRING
;
else
CRYPT_EncodeLen
(
encodedLen
,
pbEncoded
,
&
lenBytes
);
ptr
=
pbEncoded
;
pbEncoded
+=
lenBytes
;
*
ptr
++
=
ASN_IA5STRING
;
CRYPT_EncodeLen
(
encodedLen
,
ptr
,
&
lenBytes
);
ptr
+=
lenBytes
;
for
(
i
=
0
;
ret
&&
i
<
encodedLen
;
i
++
)
for
(
i
=
0
;
ret
&&
i
<
encodedLen
;
i
++
)
{
{
if
(
str
[
i
]
<=
0x7f
)
if
(
str
[
i
]
<=
0x7f
)
*
p
bEncoded
++
=
(
BYTE
)
str
[
i
];
*
p
tr
++
=
(
BYTE
)
str
[
i
];
else
else
{
{
*
pcbEncoded
=
i
;
*
pcbEncoded
=
i
;
...
@@ -1687,6 +1700,8 @@ static BOOL CRYPT_AsnEncodeIA5String(const CERT_NAME_VALUE *value,
...
@@ -1687,6 +1700,8 @@ static BOOL CRYPT_AsnEncodeIA5String(const CERT_NAME_VALUE *value,
ret
=
FALSE
;
ret
=
FALSE
;
}
}
}
}
if
(
!
ret
&&
(
dwFlags
&
CRYPT_ENCODE_ALLOC_FLAG
))
CryptMemFree
(
*
(
BYTE
**
)
pbEncoded
);
}
}
}
}
return
ret
;
return
ret
;
...
...
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