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
5a378a5c
Commit
5a378a5c
authored
Jan 15, 2002
by
Kurt Zeilenga
Browse files
A very basic
UTF-8
check
parent
19f3ba21
Changes
1
Hide whitespace changes
Inline
Side-by-side
servers/slapd/schema_init.c
View file @
5a378a5c
...
...
@@ -473,8 +473,36 @@ UTF8StringValidate(
/* get the length indicated by the first byte */
len
=
LDAP_UTF8_CHARLEN
(
u
);
/* should not be zero */
if
(
len
==
0
)
return
LDAP_INVALID_SYNTAX
;
/* very basic checks */
switch
(
len
)
{
case
6
:
if
(
u
[
5
]
>=
0xFE
)
{
return
LDAP_INVALID_SYNTAX
;
}
case
5
:
if
(
u
[
4
]
>=
0xFE
)
{
return
LDAP_INVALID_SYNTAX
;
}
case
4
:
if
(
u
[
3
]
>=
0xFE
)
{
return
LDAP_INVALID_SYNTAX
;
}
case
3
:
if
(
u
[
2
]
>=
0xFE
)
{
return
LDAP_INVALID_SYNTAX
;
}
case
2
:
if
(
u
[
1
]
>=
0xFE
)
{
return
LDAP_INVALID_SYNTAX
;
}
case
1
:
if
(
u
[
0
]
>=
0xFE
)
{
return
LDAP_INVALID_SYNTAX
;
}
break
;
default:
return
LDAP_INVALID_SYNTAX
;
}
/* make sure len corresponds with the offset
to the next character */
...
...
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