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
61957d82
Commit
61957d82
authored
Apr 14, 2022
by
Paul Gofman
Committed by
Alexandre Julliard
May 03, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Fix filling short output in cert_name_to_str_with_indent().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
20fd7dac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
34 deletions
+34
-34
str.c
dlls/crypt32/str.c
+30
-31
str.c
dlls/crypt32/tests/str.c
+4
-3
No files found.
dlls/crypt32/str.c
View file @
61957d82
...
...
@@ -375,14 +375,6 @@ static DWORD quote_rdn_value_to_str_w(DWORD dwValueType,
default:
FIXME
(
"string type %ld unimplemented
\n
"
,
dwValueType
);
}
if
(
psz
&&
csz
)
{
*
(
psz
+
ret
)
=
'\0'
;
csz
--
;
ret
++
;
}
else
ret
++
;
TRACE
(
"returning %ld (%s)
\n
"
,
ret
,
debugstr_w
(
psz
));
return
ret
;
}
...
...
@@ -580,6 +572,7 @@ DWORD cert_name_to_str_with_indent(DWORD dwCertEncodingType, DWORD indentLevel,
DWORD
ret
=
0
,
bytes
=
0
;
BOOL
bRet
;
CERT_NAME_INFO
*
info
;
DWORD
chars
;
if
(
dwStrType
&
unsupportedFlags
)
FIXME
(
"unsupported flags: %08lx
\n
"
,
dwStrType
&
unsupportedFlags
);
...
...
@@ -607,14 +600,17 @@ DWORD cert_name_to_str_with_indent(DWORD dwCertEncodingType, DWORD indentLevel,
else
rdnSep
=
L" + "
;
rdnSepLen
=
lstrlenW
(
rdnSep
);
for
(
i
=
0
;
(
!
psz
||
ret
<
csz
)
&&
i
<
info
->
cRDN
;
i
++
)
if
(
!
csz
)
psz
=
NULL
;
for
(
i
=
0
;
i
<
info
->
cRDN
;
i
++
)
{
for
(
j
=
0
;
(
!
psz
||
ret
<
csz
)
&&
j
<
rdn
->
cRDNAttr
;
j
++
)
if
(
psz
&&
ret
+
1
==
csz
)
break
;
for
(
j
=
0
;
j
<
rdn
->
cRDNAttr
;
j
++
)
{
DWORD
chars
;
LPCSTR
prefixA
=
NULL
;
LPCWSTR
prefixW
=
NULL
;
if
(
psz
&&
ret
+
1
==
csz
)
break
;
if
((
dwStrType
&
0x000000ff
)
==
CERT_OID_NAME_STR
)
prefixA
=
rdn
->
rgRDNAttr
[
j
].
pszObjId
;
else
if
((
dwStrType
&
0x000000ff
)
==
CERT_X500_NAME_STR
)
...
...
@@ -644,6 +640,7 @@ DWORD cert_name_to_str_with_indent(DWORD dwCertEncodingType, DWORD indentLevel,
chars
=
lstrlenW
(
indent
);
ret
+=
chars
;
}
if
(
psz
&&
ret
+
1
==
csz
)
break
;
}
if
(
prefixW
)
{
...
...
@@ -659,38 +656,40 @@ DWORD cert_name_to_str_with_indent(DWORD dwCertEncodingType, DWORD indentLevel,
psz
?
psz
+
ret
:
NULL
,
psz
?
csz
-
ret
-
1
:
0
);
ret
+=
chars
;
}
chars
=
quote_rdn_value_to_str_w
(
rdn
->
rgRDNAttr
[
j
].
dwValueType
,
&
rdn
->
rgRDNAttr
[
j
].
Value
,
psz
?
psz
+
ret
:
NULL
,
psz
?
csz
-
ret
:
0
);
if
(
chars
)
ret
+=
chars
-
1
;
if
(
psz
&&
ret
+
1
==
csz
)
break
;
chars
=
quote_rdn_value_to_str_w
(
rdn
->
rgRDNAttr
[
j
].
dwValueType
,
&
rdn
->
rgRDNAttr
[
j
].
Value
,
psz
?
psz
+
ret
:
NULL
,
psz
?
csz
-
ret
-
1
:
0
);
ret
+=
chars
;
if
(
j
<
rdn
->
cRDNAttr
-
1
)
{
if
(
psz
&&
ret
<
csz
-
rdnSepLen
-
1
)
memcpy
(
psz
+
ret
,
rdnSep
,
rdnSepLen
*
sizeof
(
WCHAR
));
ret
+=
rdnSepLen
;
if
(
psz
)
{
chars
=
min
(
rdnSepLen
,
csz
-
ret
-
1
);
memcpy
(
psz
+
ret
,
rdnSep
,
chars
*
sizeof
(
WCHAR
));
ret
+=
chars
;
}
else
ret
+=
rdnSepLen
;
}
}
if
(
psz
&&
ret
+
1
==
csz
)
break
;
if
(
i
<
info
->
cRDN
-
1
)
{
if
(
psz
&&
ret
<
csz
-
sepLen
-
1
)
memcpy
(
psz
+
ret
,
sep
,
sepLen
*
sizeof
(
WCHAR
));
ret
+=
sepLen
;
if
(
psz
)
{
chars
=
min
(
sepLen
,
csz
-
ret
-
1
);
memcpy
(
psz
+
ret
,
sep
,
chars
*
sizeof
(
WCHAR
));
ret
+=
chars
;
}
else
ret
+=
sepLen
;
}
if
(
reverse
)
rdn
--
;
else
rdn
++
;
}
LocalFree
(
info
);
}
if
(
psz
&&
csz
)
{
*
(
psz
+
ret
)
=
'\0'
;
ret
++
;
}
else
ret
++
;
return
ret
;
if
(
psz
&&
csz
)
psz
[
ret
]
=
0
;
return
ret
+
1
;
}
DWORD
WINAPI
CertNameToStrW
(
DWORD
dwCertEncodingType
,
PCERT_NAME_BLOB
pName
,
...
...
dlls/crypt32/tests/str.c
View file @
61957d82
...
...
@@ -445,14 +445,14 @@ static void test_NameToStrConversionW_(unsigned int line, PCERT_NAME_BLOB pName,
memset
(
buffer
,
0xcc
,
sizeof
(
buffer
));
retlen
=
CertNameToStrW
(
X509_ASN_ENCODING
,
pName
,
dwStrType
,
buffer
,
len
-
1
);
todo_wine
ok
(
retlen
==
len
-
1
,
"line %u: expected %lu chars, got %lu
\n
"
,
line
,
len
-
1
,
retlen
);
ok
(
retlen
==
len
-
1
,
"line %u: expected %lu chars, got %lu
\n
"
,
line
,
len
-
1
,
retlen
);
ok
(
!
wcsncmp
(
buffer
,
expected
,
retlen
-
1
),
"line %u: expected %s, got %s
\n
"
,
line
,
wine_dbgstr_w
(
expected
),
wine_dbgstr_w
(
buffer
));
ok
(
!
buffer
[
retlen
-
1
],
"line %u: string is not zero terminated.
\n
"
,
line
);
memset
(
buffer
,
0xcc
,
sizeof
(
buffer
));
retlen
=
CertNameToStrW
(
X509_ASN_ENCODING
,
pName
,
dwStrType
,
buffer
,
0
);
todo_wine
ok
(
retlen
==
len
,
"line %u: expected %lu chars, got %lu
\n
"
,
line
,
len
-
1
,
retlen
);
ok
(
retlen
==
len
,
"line %u: expected %lu chars, got %lu
\n
"
,
line
,
len
-
1
,
retlen
);
ok
(
buffer
[
0
]
==
0xcccc
,
"line %u: got %s
\n
"
,
line
,
wine_dbgstr_w
(
buffer
));
}
...
...
@@ -768,7 +768,8 @@ static void test_CertGetNameString_value_(unsigned int line, PCCERT_CONTEXT cont
ok
(
!
wcscmp
(
strW
,
expectedW
),
"line %u: unexpected value %s.
\n
"
,
line
,
debugstr_w
(
strW
));
strW
[
0
]
=
strW
[
1
]
=
0xcccc
;
retlen
=
CertGetNameStringW
(
context
,
type
,
0
,
type_para
,
strW
,
len
-
1
);
todo_wine
ok
(
retlen
==
len
-
1
,
"line %u: unexpected len %lu, expected %lu.
\n
"
,
line
,
retlen
,
len
-
1
);
todo_wine_if
(
type
!=
CERT_NAME_RDN_TYPE
)
ok
(
retlen
==
len
-
1
,
"line %u: unexpected len %lu, expected %lu.
\n
"
,
line
,
retlen
,
len
-
1
);
ok
(
!
wcsncmp
(
strW
,
expectedW
,
retlen
-
1
),
"line %u: string data mismatch.
\n
"
,
line
);
ok
(
!
strW
[
retlen
-
1
],
"line %u: string is not zero terminated.
\n
"
,
line
);
retlen
=
CertGetNameStringA
(
context
,
type
,
0
,
type_para
,
NULL
,
len
-
1
);
...
...
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