Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
cb3f80c0
Commit
cb3f80c0
authored
Aug 25, 2002
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fs/openpromfs/inode.c: Prevent overflow of sprintf buffer.
parent
5e12f283
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
fs/openpromfs/inode.c
fs/openpromfs/inode.c
+7
-4
No files found.
fs/openpromfs/inode.c
View file @
cb3f80c0
...
...
@@ -282,24 +282,27 @@ static ssize_t property_read(struct file *filp, char *buf,
k
+=
count
;
}
else
if
(
op
->
flag
&
OPP_HEXSTRING
)
{
char
buffer
[
2
];
char
buffer
[
8
];
if
((
k
<
i
-
1
)
&&
(
k
&
1
))
{
sprintf
(
buffer
,
"%02x"
,
*
(
op
->
value
+
(
k
>>
1
)));
sprintf
(
buffer
,
"%02x"
,
(
unsigned
)
*
(
op
->
value
+
(
k
>>
1
))
&
0xff
);
if
(
put_user
(
buffer
[
1
],
&
buf
[
k
++
-
filp
->
f_pos
]))
return
-
EFAULT
;
count
--
;
}
for
(;
(
count
>
1
)
&&
(
k
<
i
-
1
);
k
+=
2
)
{
sprintf
(
buffer
,
"%02x"
,
*
(
op
->
value
+
(
k
>>
1
)));
sprintf
(
buffer
,
"%02x"
,
(
unsigned
)
*
(
op
->
value
+
(
k
>>
1
))
&
0xff
);
if
(
copy_to_user
(
buf
+
k
-
filp
->
f_pos
,
buffer
,
2
))
return
-
EFAULT
;
count
-=
2
;
}
if
(
count
&&
(
k
<
i
-
1
))
{
sprintf
(
buffer
,
"%02x"
,
*
(
op
->
value
+
(
k
>>
1
)));
sprintf
(
buffer
,
"%02x"
,
(
unsigned
)
*
(
op
->
value
+
(
k
>>
1
))
&
0xff
);
if
(
put_user
(
buffer
[
0
],
&
buf
[
k
++
-
filp
->
f_pos
]))
return
-
EFAULT
;
count
--
;
...
...
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