Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
net-tools
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
net-tools
Commits
cb15dc24
Commit
cb15dc24
authored
Jun 15, 2013
by
Lehner Florian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix issues caused by replaceing strcpy() with safe_strncpy()
Signed-off-by:
Lehner Florian
<
dev@der-flo.net
>
parent
604785ad
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
10 deletions
+8
-10
lib/inet_gr.c
lib/inet_gr.c
+5
-4
route.c
route.c
+2
-4
slattach.c
slattach.c
+1
-2
No files found.
lib/inet_gr.c
View file @
cb15dc24
...
@@ -109,14 +109,15 @@ int rprint_fib(int ext, int numeric)
...
@@ -109,14 +109,15 @@ int rprint_fib(int ext, int numeric)
sin_netmask
=
(
struct
sockaddr_in
*
)
&
snet_mask
;
sin_netmask
=
(
struct
sockaddr_in
*
)
&
snet_mask
;
safe_strncpy
(
net_addr
,
INET_sprintmask
(
&
snet_target
,
safe_strncpy
(
net_addr
,
INET_sprintmask
(
&
snet_target
,
(
numeric
|
0x8000
|
(
iflags
&
RTF_HOST
?
0x4000
:
0
)),
(
numeric
|
0x8000
|
(
iflags
&
RTF_HOST
?
0x4000
:
0
)),
sin_netmask
->
sin_addr
.
s_addr
),
sin_netmask
->
sin_addr
.
s_addr
),
sizeof
(
net_addr
));
sizeof
(
net_addr
))
;
net_addr
[
15
]
=
'\0'
;
safe_strncpy
(
gate_addr
,
inet_aftype
.
sprint
(
&
snet_gateway
,
numeric
|
0x4000
),
safe_strncpy
(
gate_addr
,
inet_aftype
.
sprint
(
&
snet_gateway
,
numeric
|
0x4000
),
sizeof
(
gate_addr
));
sizeof
(
gate_addr
));
gate_addr
[
15
]
=
'\0'
;
safe_strncpy
(
mask_addr
,
inet_aftype
.
sprint
(
&
snet_mask
,
1
),
safe_strncpy
(
mask_addr
,
inet_aftype
.
sprint
(
&
snet_mask
,
1
),
sizeof
(
mask_addr
));
sizeof
(
mask_addr
))
;
mask_addr
[
15
]
=
'\0'
;
/* Decode the flags. */
/* Decode the flags. */
flags
[
0
]
=
'\0'
;
flags
[
0
]
=
'\0'
;
...
...
route.c
View file @
cb15dc24
...
@@ -136,10 +136,8 @@ int main(int argc, char **argv)
...
@@ -136,10 +136,8 @@ int main(int argc, char **argv)
/* getopts and -net wont work :-/ */
/* getopts and -net wont work :-/ */
for
(
tmp
=
argv
;
*
tmp
;
tmp
++
)
{
for
(
tmp
=
argv
;
*
tmp
;
tmp
++
)
{
if
(
!
strcmp
(
*
tmp
,
"-net"
))
if
(
!
strcmp
(
*
tmp
,
"-net"
)
||
!
strcmp
(
*
tmp
,
"-host"
))
safe_strncpy
(
*
tmp
,
"#net"
,
sizeof
(
*
tmp
));
(
*
tmp
)[
0
]
=
'#'
;
else
if
(
!
strcmp
(
*
tmp
,
"-host"
))
safe_strncpy
(
*
tmp
,
"#host"
,
sizeof
(
*
tmp
));
}
}
/* Fetch the command-line arguments. */
/* Fetch the command-line arguments. */
...
...
slattach.c
View file @
cb15dc24
...
@@ -609,7 +609,7 @@ version(void)
...
@@ -609,7 +609,7 @@ version(void)
int
int
main
(
int
argc
,
char
*
argv
[])
main
(
int
argc
,
char
*
argv
[])
{
{
char
path_buf
[
128
];
char
path_buf
[
128
]
=
""
;
char
*
path_dev
;
char
*
path_dev
;
char
buff
[
128
];
char
buff
[
128
];
const
char
*
speed
=
NULL
;
const
char
*
speed
=
NULL
;
...
@@ -621,7 +621,6 @@ main(int argc, char *argv[])
...
@@ -621,7 +621,6 @@ main(int argc, char *argv[])
{
NULL
,
0
,
NULL
,
0
}
{
NULL
,
0
,
NULL
,
0
}
};
};
safe_strncpy
(
path_buf
,
""
,
sizeof
(
path_buf
));
path_dev
=
path_buf
;
path_dev
=
path_buf
;
/* Scan command line for any arguments. */
/* Scan command line for any arguments. */
...
...
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