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
nexedi
linux
Commits
c735483d
Commit
c735483d
authored
Sep 21, 2014
by
Helge Deller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parisc: pdc_stable.c: Avoid potential stack overflows
Signed-off-by:
Helge Deller
<
deller@gmx.de
>
parent
94c457de
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
drivers/parisc/pdc_stable.c
drivers/parisc/pdc_stable.c
+7
-5
No files found.
drivers/parisc/pdc_stable.c
View file @
c735483d
...
@@ -278,7 +278,7 @@ pdcspath_hwpath_write(struct pdcspath_entry *entry, const char *buf, size_t coun
...
@@ -278,7 +278,7 @@ pdcspath_hwpath_write(struct pdcspath_entry *entry, const char *buf, size_t coun
{
{
struct
hardware_path
hwpath
;
struct
hardware_path
hwpath
;
unsigned
short
i
;
unsigned
short
i
;
char
in
[
count
+
1
],
*
temp
;
char
in
[
64
],
*
temp
;
struct
device
*
dev
;
struct
device
*
dev
;
int
ret
;
int
ret
;
...
@@ -286,8 +286,9 @@ pdcspath_hwpath_write(struct pdcspath_entry *entry, const char *buf, size_t coun
...
@@ -286,8 +286,9 @@ pdcspath_hwpath_write(struct pdcspath_entry *entry, const char *buf, size_t coun
return
-
EINVAL
;
return
-
EINVAL
;
/* We'll use a local copy of buf */
/* We'll use a local copy of buf */
memset
(
in
,
0
,
count
+
1
);
count
=
min_t
(
size_t
,
count
,
sizeof
(
in
)
-
1
);
strncpy
(
in
,
buf
,
count
);
strncpy
(
in
,
buf
,
count
);
in
[
count
]
=
'\0'
;
/* Let's clean up the target. 0xff is a blank pattern */
/* Let's clean up the target. 0xff is a blank pattern */
memset
(
&
hwpath
,
0xff
,
sizeof
(
hwpath
));
memset
(
&
hwpath
,
0xff
,
sizeof
(
hwpath
));
...
@@ -393,14 +394,15 @@ pdcspath_layer_write(struct pdcspath_entry *entry, const char *buf, size_t count
...
@@ -393,14 +394,15 @@ pdcspath_layer_write(struct pdcspath_entry *entry, const char *buf, size_t count
{
{
unsigned
int
layers
[
6
];
/* device-specific info (ctlr#, unit#, ...) */
unsigned
int
layers
[
6
];
/* device-specific info (ctlr#, unit#, ...) */
unsigned
short
i
;
unsigned
short
i
;
char
in
[
count
+
1
],
*
temp
;
char
in
[
64
],
*
temp
;
if
(
!
entry
||
!
buf
||
!
count
)
if
(
!
entry
||
!
buf
||
!
count
)
return
-
EINVAL
;
return
-
EINVAL
;
/* We'll use a local copy of buf */
/* We'll use a local copy of buf */
memset
(
in
,
0
,
count
+
1
);
count
=
min_t
(
size_t
,
count
,
sizeof
(
in
)
-
1
);
strncpy
(
in
,
buf
,
count
);
strncpy
(
in
,
buf
,
count
);
in
[
count
]
=
'\0'
;
/* Let's clean up the target. 0 is a blank pattern */
/* Let's clean up the target. 0 is a blank pattern */
memset
(
&
layers
,
0
,
sizeof
(
layers
));
memset
(
&
layers
,
0
,
sizeof
(
layers
));
...
@@ -765,7 +767,7 @@ static ssize_t pdcs_auto_write(struct kobject *kobj,
...
@@ -765,7 +767,7 @@ static ssize_t pdcs_auto_write(struct kobject *kobj,
return
-
EINVAL
;
return
-
EINVAL
;
/* We'll use a local copy of buf */
/* We'll use a local copy of buf */
count
=
min_t
(
size_t
,
count
,
7
);
count
=
min_t
(
size_t
,
count
,
sizeof
(
in
)
-
1
);
strncpy
(
in
,
buf
,
count
);
strncpy
(
in
,
buf
,
count
);
in
[
count
]
=
'\0'
;
in
[
count
]
=
'\0'
;
...
...
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