Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
openldap
OpenLDAP
Commits
e21e9003
Commit
e21e9003
authored
Jan 15, 2002
by
Howard Chu
Browse files
Use LDAP_UTF8_CHARLEN2 to check shortest possible encoding
parent
2d51ad52
Changes
2
Hide whitespace changes
Inline
Side-by-side
libraries/liblunicode/ucstr.c
View file @
e21e9003
...
...
@@ -173,7 +173,7 @@ char * UTF8normalize(
/* s[i] is non-ascii */
/* convert everything up to next ascii to ucs-4 */
while
(
i
<
len
)
{
clen
=
LDAP_UTF8_CHARLEN
(
s
+
i
);
clen
=
LDAP_UTF8_CHARLEN
2
(
s
+
i
,
clen
);
if
(
clen
==
0
)
{
free
(
ucs
);
free
(
out
);
...
...
servers/slapd/schema_init.c
View file @
e21e9003
...
...
@@ -471,28 +471,28 @@ UTF8StringValidate(
for
(
count
=
in
->
bv_len
;
count
>
0
;
count
-=
len
,
u
+=
len
)
{
/* get the length indicated by the first byte */
len
=
LDAP_UTF8_CHARLEN
(
u
);
len
=
LDAP_UTF8_CHARLEN
2
(
u
,
len
);
/* very basic checks */
switch
(
len
)
{
case
6
:
if
(
u
[
5
]
>
=
0x
FE
)
{
if
(
(
u
[
5
]
&
0xC0
)
!
=
0x
80
)
{
return
LDAP_INVALID_SYNTAX
;
}
case
5
:
if
(
u
[
4
]
>
=
0x
FE
)
{
if
(
(
u
[
4
]
&
0xC0
)
!
=
0x
80
)
{
return
LDAP_INVALID_SYNTAX
;
}
case
4
:
if
(
u
[
3
]
>
=
0x
FE
)
{
if
(
(
u
[
3
]
&
0xC0
)
!
=
0x
80
)
{
return
LDAP_INVALID_SYNTAX
;
}
case
3
:
if
(
u
[
2
]
>
=
0x
FE
)
{
if
(
(
u
[
2
]
&
0xC0
)
!
=
0x
80
)
{
return
LDAP_INVALID_SYNTAX
;
}
case
2
:
if
(
u
[
1
]
>
=
0x
FE
)
{
if
(
(
u
[
1
]
&
0xC0
)
!
=
0x
80
)
{
return
LDAP_INVALID_SYNTAX
;
}
case
1
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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