Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
3eac8778
Commit
3eac8778
authored
Apr 07, 2009
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
autofs4: use memchr() in invalid_string()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
66672fef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
6 deletions
+4
-6
fs/autofs4/dev-ioctl.c
fs/autofs4/dev-ioctl.c
+4
-6
No files found.
fs/autofs4/dev-ioctl.c
View file @
3eac8778
...
@@ -54,11 +54,10 @@ static int check_name(const char *name)
...
@@ -54,11 +54,10 @@ static int check_name(const char *name)
* Check a string doesn't overrun the chunk of
* Check a string doesn't overrun the chunk of
* memory we copied from user land.
* 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
(
memchr
(
str
,
0
,
size
))
if
(
!*
str
++
)
return
0
;
return
0
;
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -138,8 +137,7 @@ static int validate_dev_ioctl(int cmd, struct autofs_dev_ioctl *param)
...
@@ -138,8 +137,7 @@ static int validate_dev_ioctl(int cmd, struct autofs_dev_ioctl *param)
}
}
if
(
param
->
size
>
sizeof
(
*
param
))
{
if
(
param
->
size
>
sizeof
(
*
param
))
{
err
=
invalid_str
(
param
->
path
,
err
=
invalid_str
(
param
->
path
,
param
->
size
-
sizeof
(
*
param
));
(
void
*
)
((
size_t
)
param
+
param
->
size
));
if
(
err
)
{
if
(
err
)
{
AUTOFS_WARN
(
AUTOFS_WARN
(
"path string terminator missing for cmd(0x%08x)"
,
"path string terminator missing for cmd(0x%08x)"
,
...
...
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