Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
R128
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ermine
R128
Commits
3eac8778
Commit
3eac8778
authored
15 years ago
by
Al Viro
Browse files
Options
Downloads
Patches
Plain Diff
autofs4: use memchr() in invalid_string()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
66672fef
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fs/autofs4/dev-ioctl.c
+4
-6
4 additions, 6 deletions
fs/autofs4/dev-ioctl.c
with
4 additions
and
6 deletions
fs/autofs4/dev-ioctl.c
+
4
−
6
View file @
3eac8778
...
...
@@ -54,11 +54,10 @@ static int check_name(const char *name)
* Check a string doesn't overrun the chunk of
* memory we copied from user land.
*/
static
int
invalid_str
(
char
*
str
,
void
*
end
)
static
int
invalid_str
(
char
*
str
,
size_t
size
)
{
while
((
void
*
)
str
<=
end
)
if
(
!*
str
++
)
return
0
;
if
(
memchr
(
str
,
0
,
size
))
return
0
;
return
-
EINVAL
;
}
...
...
@@ -138,8 +137,7 @@ static int validate_dev_ioctl(int cmd, struct autofs_dev_ioctl *param)
}
if
(
param
->
size
>
sizeof
(
*
param
))
{
err
=
invalid_str
(
param
->
path
,
(
void
*
)
((
size_t
)
param
+
param
->
size
));
err
=
invalid_str
(
param
->
path
,
param
->
size
-
sizeof
(
*
param
));
if
(
err
)
{
AUTOFS_WARN
(
"path string terminator missing for cmd(0x%08x)"
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment