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
604785ad
Commit
604785ad
authored
Jun 14, 2013
by
Lehner Florian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace all remaining strcpy() with safe_strncpy()
Signed-off-by:
Lehner Florian
<
dev@der-flo.net
>
parent
3a2961de
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
69 additions
and
67 deletions
+69
-67
arp.c
arp.c
+4
-4
lib/af.c
lib/af.c
+2
-2
lib/ax25.c
lib/ax25.c
+1
-1
lib/getargs.c
lib/getargs.c
+2
-1
lib/inet.c
lib/inet.c
+1
-1
lib/inet6.c
lib/inet6.c
+2
-2
lib/inet6_gr.c
lib/inet6_gr.c
+10
-9
lib/inet6_sr.c
lib/inet6_sr.c
+4
-4
lib/inet_gr.c
lib/inet_gr.c
+14
-17
lib/interface.c
lib/interface.c
+18
-18
lib/ipx_gr.c
lib/ipx_gr.c
+4
-3
lib/rose.c
lib/rose.c
+2
-1
nameif.c
nameif.c
+1
-1
route.c
route.c
+3
-2
slattach.c
slattach.c
+1
-1
No files found.
arp.c
View file @
604785ad
...
...
@@ -197,7 +197,7 @@ static int arp_del(char **args)
if
(
flags
==
0
)
flags
=
3
;
s
trcpy
(
req
.
arp_dev
,
device
);
s
afe_strncpy
(
req
.
arp_dev
,
device
,
sizeof
(
req
.
arp_dev
)
);
/* unfortuatelly the kernel interface does not allow us to
delete private entries anlone, so we need this hack
...
...
@@ -373,7 +373,7 @@ static int arp_set(char **args)
/* Fill in the remainder of the request. */
req
.
arp_flags
=
flags
;
s
trcpy
(
req
.
arp_dev
,
device
);
s
afe_strncpy
(
req
.
arp_dev
,
device
,
sizeof
(
req
.
arp_dev
)
);
/* Call the kernel. */
if
(
opt_v
)
...
...
@@ -560,8 +560,8 @@ static int arp_show(char *name)
}
/* Bypass header -- read until newline */
if
(
fgets
(
line
,
sizeof
(
line
),
fp
)
!=
(
char
*
)
NULL
)
{
s
trcpy
(
mask
,
"-"
);
s
trcpy
(
dev
,
"-"
);
s
afe_strncpy
(
mask
,
"-"
,
sizeof
(
mask
)
);
s
afe_strncpy
(
dev
,
"-"
,
sizeof
(
dev
)
);
/* Read the ARP cache entries. */
for
(;
fgets
(
line
,
sizeof
(
line
),
fp
);)
{
num
=
sscanf
(
line
,
"%s 0x%x 0x%x %99s %99s %99s
\n
"
,
...
...
lib/af.c
View file @
604785ad
...
...
@@ -201,7 +201,7 @@ void aftrans_def(char *tool, char *argv0, char *dflt)
char
*
tmp
;
char
*
buf
;
s
trcpy
(
afname
,
dflt
);
s
afe_strncpy
(
afname
,
dflt
,
sizeof
(
afname
)
);
if
(
!
(
tmp
=
strrchr
(
argv0
,
'/'
)))
tmp
=
argv0
;
/* no slash?! */
...
...
@@ -227,7 +227,7 @@ void aftrans_def(char *tool, char *argv0, char *dflt)
afname
[
0
]
=
'\0'
;
if
(
aftrans_opt
(
buf
))
s
trcpy
(
afname
,
buf
);
s
afe_strncpy
(
afname
,
buf
,
sizeof
(
afname
)
);
free
(
buf
);
}
...
...
lib/ax25.c
View file @
604785ad
...
...
@@ -111,7 +111,7 @@ static int AX25_input(int type, char *bufp, struct sockaddr *sap)
/* Callsign too long? */
if
((
i
==
6
)
&&
(
*
bufp
!=
'-'
)
&&
(
*
bufp
!=
'\0'
))
{
s
trcpy
(
AX25_errmsg
,
_
(
"Callsign too long"
));
s
afe_strncpy
(
AX25_errmsg
,
_
(
"Callsign too long"
),
sizeof
(
AX25_errmsg
));
if
(
_DEBUG
)
fprintf
(
stderr
,
"ax25_input(%s): %s !
\n
"
,
AX25_errmsg
,
orig
);
errno
=
E2BIG
;
...
...
lib/getargs.c
View file @
604785ad
...
...
@@ -24,6 +24,7 @@
#include <unistd.h>
#include "net-support.h"
#include "pathnames.h"
#include "util.h"
/* Split the input string into multiple fields. */
...
...
@@ -41,7 +42,7 @@ int getargs(char *string, char *arguments[])
*/
sp
=
string
;
i
=
0
;
s
trcpy
(
temp
,
string
);
s
afe_strncpy
(
temp
,
string
,
sizeof
(
temp
)
);
ptr
=
temp
;
/*
...
...
lib/inet.c
View file @
604785ad
...
...
@@ -215,7 +215,7 @@ static int INET_rresolve(char *name, size_t len, struct sockaddr_in *sin,
pn
->
next
=
INET_nn
;
pn
->
host
=
host
;
pn
->
name
=
(
char
*
)
xmalloc
(
strlen
(
name
)
+
1
);
s
trcpy
(
pn
->
name
,
name
);
s
afe_strncpy
(
pn
->
name
,
name
,
sizeof
(
pn
->
name
)
);
INET_nn
=
pn
;
return
(
0
);
...
...
lib/inet6.c
View file @
604785ad
...
...
@@ -103,9 +103,9 @@ static int INET6_rresolve(char *name, struct sockaddr_in6 *sin6, int numeric)
}
if
(
IN6_IS_ADDR_UNSPECIFIED
(
&
sin6
->
sin6_addr
))
{
if
(
numeric
&
0x8000
)
s
trcpy
(
name
,
"default"
);
s
afe_strncpy
(
name
,
"default"
,
sizeof
(
name
)
);
else
s
trcpy
(
name
,
"[::]"
);
s
afe_strncpy
(
name
,
"[::]"
,
sizeof
(
name
)
);
return
(
0
);
}
...
...
lib/inet6_gr.c
View file @
604785ad
...
...
@@ -31,6 +31,7 @@
#include "pathnames.h"
#include "intl.h"
#include "net-features.h"
#include "util.h"
/* neighbour discovery from linux-2.4.0/include/net/neighbour.h */
...
...
@@ -216,31 +217,31 @@ int rprint_cache6(int ext, int numeric)
/* Decode the state */
switch
(
state
)
{
case
NUD_NONE
:
s
trcpy
(
statestr
,
"NONE"
);
s
afe_strncpy
(
statestr
,
"NONE"
,
sizeof
(
statestr
)
);
break
;
case
NUD_INCOMPLETE
:
s
trcpy
(
statestr
,
"INCOMPLETE"
);
s
afe_strncpy
(
statestr
,
"INCOMPLETE"
,
sizeof
(
statestr
)
);
break
;
case
NUD_REACHABLE
:
s
trcpy
(
statestr
,
"REACHABLE"
);
s
afe_strncpy
(
statestr
,
"REACHABLE"
,
sizeof
(
statestr
)
);
break
;
case
NUD_STALE
:
s
trcpy
(
statestr
,
"STALE"
);
s
afe_strncpy
(
statestr
,
"STALE"
,
sizeof
(
statestr
)
);
break
;
case
NUD_DELAY
:
s
trcpy
(
statestr
,
"DELAY"
);
s
afe_strncpy
(
statestr
,
"DELAY"
,
sizeof
(
statestr
)
);
break
;
case
NUD_PROBE
:
s
trcpy
(
statestr
,
"PROBE"
);
s
afe_strncpy
(
statestr
,
"PROBE"
,
sizeof
(
statestr
)
);
break
;
case
NUD_FAILED
:
s
trcpy
(
statestr
,
"FAILED"
);
s
afe_strncpy
(
statestr
,
"FAILED"
,
sizeof
(
statestr
)
);
break
;
case
NUD_NOARP
:
s
trcpy
(
statestr
,
"NOARP"
);
s
afe_strncpy
(
statestr
,
"NOARP"
,
sizeof
(
statestr
)
);
break
;
case
NUD_PERMANENT
:
s
trcpy
(
statestr
,
"PERM"
);
s
afe_strncpy
(
statestr
,
"PERM"
,
sizeof
(
statestr
)
);
break
;
default:
snprintf
(
statestr
,
sizeof
(
statestr
),
"UNKNOWN(%02x)"
,
state
);
...
...
lib/inet6_sr.c
View file @
604785ad
...
...
@@ -33,7 +33,7 @@
#include "pathnames.h"
#include "intl.h"
#include "net-features.h"
#include "util.h"
extern
struct
aftype
inet6_aftype
;
...
...
@@ -63,7 +63,7 @@ static int INET6_setroute(int action, int options, char **args)
if
(
*
args
==
NULL
)
return
(
usage
());
s
trcpy
(
target
,
*
args
++
);
s
afe_strncpy
(
target
,
*
args
++
,
sizeof
(
target
)
);
if
(
!
strcmp
(
target
,
"default"
))
{
prefix_len
=
0
;
memset
(
&
sa6
,
0
,
sizeof
(
sa6
));
...
...
@@ -112,7 +112,7 @@ static int INET6_setroute(int action, int options, char **args)
return
(
usage
());
if
(
rt
.
rtmsg_flags
&
RTF_GATEWAY
)
return
(
usage
());
s
trcpy
(
gateway
,
*
args
);
s
afe_strncpy
(
gateway
,
*
args
,
sizeof
(
gateway
)
);
if
(
inet6_aftype
.
input
(
1
,
gateway
,
(
struct
sockaddr
*
)
&
sa6
)
<
0
)
{
inet6_aftype
.
herror
(
gateway
);
...
...
@@ -152,7 +152,7 @@ static int INET6_setroute(int action, int options, char **args)
}
if
(
devname
)
{
memset
(
&
ifr
,
0
,
sizeof
(
ifr
));
s
trcpy
(
ifr
.
ifr_name
,
devname
);
s
afe_strncpy
(
ifr
.
ifr_name
,
devname
,
sizeof
(
ifr
.
ifr_name
)
);
if
(
ioctl
(
skfd
,
SIOGIFINDEX
,
&
ifr
)
<
0
)
{
perror
(
"SIOGIFINDEX"
);
...
...
lib/inet_gr.c
View file @
604785ad
...
...
@@ -31,6 +31,7 @@
#include "intl.h"
#include "net-features.h"
#include "proc.h"
#include "util.h"
extern
struct
aftype
inet_aftype
;
extern
char
*
INET_sprintmask
(
struct
sockaddr
*
sap
,
int
numeric
,
...
...
@@ -106,16 +107,16 @@ int rprint_fib(int ext, int numeric)
(
void
)
inet_aftype
.
input
(
1
,
mask_addr
,
&
snet_mask
);
sin_netmask
=
(
struct
sockaddr_in
*
)
&
snet_mask
;
s
tr
cpy
(
net_addr
,
INET_sprintmask
(
&
snet_target
,
s
afe_strn
cpy
(
net_addr
,
INET_sprintmask
(
&
snet_target
,
(
numeric
|
0x8000
|
(
iflags
&
RTF_HOST
?
0x4000
:
0
)),
sin_netmask
->
sin_addr
.
s_addr
)
);
net_addr
[
15
]
=
'\0'
;
sin_netmask
->
sin_addr
.
s_addr
)
,
sizeof
(
net_addr
))
;
s
trcpy
(
gate_addr
,
inet_aftype
.
sprint
(
&
snet_gateway
,
numeric
|
0x4000
));
gate_addr
[
15
]
=
'\0'
;
s
afe_strncpy
(
gate_addr
,
inet_aftype
.
sprint
(
&
snet_gateway
,
numeric
|
0x4000
),
sizeof
(
gate_addr
))
;
s
trcpy
(
mask_addr
,
inet_aftype
.
sprint
(
&
snet_mask
,
1
));
mask_addr
[
15
]
=
'\0'
;
s
afe_strncpy
(
mask_addr
,
inet_aftype
.
sprint
(
&
snet_mask
,
1
),
sizeof
(
mask_addr
))
;
/* Decode the flags. */
flags
[
0
]
=
'\0'
;
...
...
@@ -125,7 +126,7 @@ int rprint_fib(int ext, int numeric)
strcat
(
flags
,
"G"
);
#if HAVE_RTF_REJECT
if
(
iflags
&
RTF_REJECT
)
s
trcpy
(
flags
,
"!"
);
s
afe_strncpy
(
flags
,
"!"
,
sizeof
(
flags
)
);
#endif
if
(
iflags
&
RTF_HOST
)
strcat
(
flags
,
"H"
);
...
...
@@ -337,23 +338,19 @@ int rprint_cache(int ext, int numeric)
/* Fetch and resolve the target address. */
(
void
)
inet_aftype
.
input
(
1
,
dest_addr
,
&
snet
);
strcpy
(
dest_addr
,
inet_aftype
.
sprint
(
&
snet
,
numeric
));
dest_addr
[
15
]
=
'\0'
;
safe_strncpy
(
dest_addr
,
inet_aftype
.
sprint
(
&
snet
,
numeric
),
sizeof
(
dest_addr
));
/* Fetch and resolve the gateway address. */
(
void
)
inet_aftype
.
input
(
1
,
gate_addr
,
&
snet
);
strcpy
(
gate_addr
,
inet_aftype
.
sprint
(
&
snet
,
numeric
));
gate_addr
[
15
]
=
'\0'
;
safe_strncpy
(
gate_addr
,
inet_aftype
.
sprint
(
&
snet
,
numeric
),
sizeof
(
gate_addr
));
/* Fetch and resolve the source. */
(
void
)
inet_aftype
.
input
(
1
,
src_addr
,
&
snet
);
strcpy
(
src_addr
,
inet_aftype
.
sprint
(
&
snet
,
numeric
));
src_addr
[
15
]
=
'\0'
;
safe_strncpy
(
src_addr
,
inet_aftype
.
sprint
(
&
snet
,
numeric
),
sizeof
(
src_addr
));
/* Fetch and resolve the SpecDst addrerss. */
(
void
)
inet_aftype
.
input
(
1
,
specdst
,
&
snet
);
strcpy
(
specdst
,
inet_aftype
.
sprint
(
&
snet
,
numeric
));
specdst
[
15
]
=
'\0'
;
safe_strncpy
(
specdst
,
inet_aftype
.
sprint
(
&
snet
,
numeric
),
sizeof
(
specdst
));
/* Decode the flags. */
flags
[
0
]
=
'\0'
;
...
...
@@ -367,7 +364,7 @@ if (format == 1) {
strcat
(
flags
,
"G"
);
#if HAVE_RTF_REJECT
if
(
iflags
&
RTF_REJECT
)
s
trcpy
(
flags
,
"!"
);
s
afe_strncpy
(
flags
,
"!"
,
sizeof
(
flags
)
);
#endif
if
(
iflags
&
RTF_REINSTATE
)
strcat
(
flags
,
"R"
);
...
...
lib/interface.c
View file @
604785ad
...
...
@@ -414,12 +414,12 @@ int if_fetch(struct interface *ife)
int
fd
;
char
*
ifname
=
ife
->
name
;
s
trcpy
(
ifr
.
ifr_name
,
ifname
);
s
afe_strncpy
(
ifr
.
ifr_name
,
ifname
,
sizeof
(
ifr
.
ifr_name
)
);
if
(
ioctl
(
skfd
,
SIOCGIFFLAGS
,
&
ifr
)
<
0
)
return
(
-
1
);
ife
->
flags
=
ifr
.
ifr_flags
;
s
trcpy
(
ifr
.
ifr_name
,
ifname
);
s
afe_strncpy
(
ifr
.
ifr_name
,
ifname
,
sizeof
(
ifr
.
ifr_name
)
);
if
(
ioctl
(
skfd
,
SIOCGIFHWADDR
,
&
ifr
)
<
0
)
memset
(
ife
->
hwaddr
,
0
,
32
);
else
...
...
@@ -427,7 +427,7 @@ int if_fetch(struct interface *ife)
ife
->
type
=
ifr
.
ifr_hwaddr
.
sa_family
;
s
trcpy
(
ifr
.
ifr_name
,
ifname
);
s
afe_strncpy
(
ifr
.
ifr_name
,
ifname
,
sizeof
(
ifr
.
ifr_name
)
);
if
(
ioctl
(
skfd
,
SIOCGIFMTU
,
&
ifr
)
<
0
)
ife
->
mtu
=
0
;
else
...
...
@@ -438,14 +438,14 @@ int if_fetch(struct interface *ife)
ife
->
type
==
ARPHRD_SLIP6
||
ife
->
type
==
ARPHRD_CSLIP6
||
ife
->
type
==
ARPHRD_ADAPT
)
{
#ifdef SIOCGOUTFILL
s
trcpy
(
ifr
.
ifr_name
,
ifname
);
s
afe_strncpy
(
ifr
.
ifr_name
,
ifname
,
sizeof
(
ifr
.
ifr_name
)
);
if
(
ioctl
(
skfd
,
SIOCGOUTFILL
,
&
ifr
)
<
0
)
ife
->
outfill
=
0
;
else
ife
->
outfill
=
(
unsigned
long
)
ifr
.
ifr_data
;
#endif
#ifdef SIOCGKEEPALIVE
s
trcpy
(
ifr
.
ifr_name
,
ifname
);
s
afe_strncpy
(
ifr
.
ifr_name
,
ifname
,
sizeof
(
ifr
.
ifr_name
)
);
if
(
ioctl
(
skfd
,
SIOCGKEEPALIVE
,
&
ifr
)
<
0
)
ife
->
keepalive
=
0
;
else
...
...
@@ -454,20 +454,20 @@ int if_fetch(struct interface *ife)
}
#endif
s
trcpy
(
ifr
.
ifr_name
,
ifname
);
s
afe_strncpy
(
ifr
.
ifr_name
,
ifname
,
sizeof
(
ifr
.
ifr_name
)
);
if
(
ioctl
(
skfd
,
SIOCGIFMAP
,
&
ifr
)
<
0
)
memset
(
&
ife
->
map
,
0
,
sizeof
(
struct
ifmap
));
else
memcpy
(
&
ife
->
map
,
&
ifr
.
ifr_map
,
sizeof
(
struct
ifmap
));
s
trcpy
(
ifr
.
ifr_name
,
ifname
);
s
afe_strncpy
(
ifr
.
ifr_name
,
ifname
,
sizeof
(
ifr
.
ifr_name
)
);
if
(
ioctl
(
skfd
,
SIOCGIFMAP
,
&
ifr
)
<
0
)
memset
(
&
ife
->
map
,
0
,
sizeof
(
struct
ifmap
));
else
ife
->
map
=
ifr
.
ifr_map
;
#ifdef HAVE_TXQUEUELEN
s
trcpy
(
ifr
.
ifr_name
,
ifname
);
s
afe_strncpy
(
ifr
.
ifr_name
,
ifname
,
sizeof
(
ifr
.
ifr_name
)
);
if
(
ioctl
(
skfd
,
SIOCGIFTXQLEN
,
&
ifr
)
<
0
)
ife
->
tx_queue_len
=
-
1
;
/* unknown value */
else
...
...
@@ -480,24 +480,24 @@ int if_fetch(struct interface *ife)
/* IPv4 address? */
fd
=
get_socket_for_af
(
AF_INET
);
if
(
fd
>=
0
)
{
s
trcpy
(
ifr
.
ifr_name
,
ifname
);
s
afe_strncpy
(
ifr
.
ifr_name
,
ifname
,
sizeof
(
ifr
.
ifr_name
)
);
ifr
.
ifr_addr
.
sa_family
=
AF_INET
;
if
(
ioctl
(
fd
,
SIOCGIFADDR
,
&
ifr
)
==
0
)
{
ife
->
has_ip
=
1
;
ife
->
addr
=
ifr
.
ifr_addr
;
s
trcpy
(
ifr
.
ifr_name
,
ifname
);
s
afe_strncpy
(
ifr
.
ifr_name
,
ifname
,
sizeof
(
ifr
.
ifr_name
)
);
if
(
ioctl
(
fd
,
SIOCGIFDSTADDR
,
&
ifr
)
<
0
)
memset
(
&
ife
->
dstaddr
,
0
,
sizeof
(
struct
sockaddr
));
else
ife
->
dstaddr
=
ifr
.
ifr_dstaddr
;
s
trcpy
(
ifr
.
ifr_name
,
ifname
);
s
afe_strncpy
(
ifr
.
ifr_name
,
ifname
,
sizeof
(
ifr
.
ifr_name
)
);
if
(
ioctl
(
fd
,
SIOCGIFBRDADDR
,
&
ifr
)
<
0
)
memset
(
&
ife
->
broadaddr
,
0
,
sizeof
(
struct
sockaddr
));
else
ife
->
broadaddr
=
ifr
.
ifr_broadaddr
;
s
trcpy
(
ifr
.
ifr_name
,
ifname
);
s
afe_strncpy
(
ifr
.
ifr_name
,
ifname
,
sizeof
(
ifr
.
ifr_name
)
);
if
(
ioctl
(
fd
,
SIOCGIFNETMASK
,
&
ifr
)
<
0
)
memset
(
&
ife
->
netmask
,
0
,
sizeof
(
struct
sockaddr
));
else
...
...
@@ -511,7 +511,7 @@ int if_fetch(struct interface *ife)
/* DDP address maybe ? */
fd
=
get_socket_for_af
(
AF_APPLETALK
);
if
(
fd
>=
0
)
{
s
trcpy
(
ifr
.
ifr_name
,
ifname
);
s
afe_strncpy
(
ifr
.
ifr_name
,
ifname
,
sizeof
(
ifr
.
ifr_name
)
);
if
(
ioctl
(
fd
,
SIOCGIFADDR
,
&
ifr
)
==
0
)
{
ife
->
ddpaddr
=
ifr
.
ifr_addr
;
ife
->
has_ddp
=
1
;
...
...
@@ -523,22 +523,22 @@ int if_fetch(struct interface *ife)
/* Look for IPX addresses with all framing types */
fd
=
get_socket_for_af
(
AF_IPX
);
if
(
fd
>=
0
)
{
s
trcpy
(
ifr
.
ifr_name
,
ifname
);
s
afe_strncpy
(
ifr
.
ifr_name
,
ifname
,
sizeof
(
ifr
.
ifr_name
)
);
if
(
!
ipx_getaddr
(
fd
,
IPX_FRAME_ETHERII
,
&
ifr
))
{
ife
->
has_ipx_bb
=
1
;
ife
->
ipxaddr_bb
=
ifr
.
ifr_addr
;
}
s
trcpy
(
ifr
.
ifr_name
,
ifname
);
s
afe_strncpy
(
ifr
.
ifr_name
,
ifname
,
sizeof
(
ifr
.
ifr_name
)
);
if
(
!
ipx_getaddr
(
fd
,
IPX_FRAME_SNAP
,
&
ifr
))
{
ife
->
has_ipx_sn
=
1
;
ife
->
ipxaddr_sn
=
ifr
.
ifr_addr
;
}
s
trcpy
(
ifr
.
ifr_name
,
ifname
);
s
afe_strncpy
(
ifr
.
ifr_name
,
ifname
,
sizeof
(
ifr
.
ifr_name
)
);
if
(
!
ipx_getaddr
(
fd
,
IPX_FRAME_8023
,
&
ifr
))
{
ife
->
has_ipx_e3
=
1
;
ife
->
ipxaddr_e3
=
ifr
.
ifr_addr
;
}
s
trcpy
(
ifr
.
ifr_name
,
ifname
);
s
afe_strncpy
(
ifr
.
ifr_name
,
ifname
,
sizeof
(
ifr
.
ifr_name
)
);
if
(
!
ipx_getaddr
(
fd
,
IPX_FRAME_8022
,
&
ifr
))
{
ife
->
has_ipx_e2
=
1
;
ife
->
ipxaddr_e2
=
ifr
.
ifr_addr
;
...
...
@@ -550,7 +550,7 @@ int if_fetch(struct interface *ife)
/* Econet address maybe? */
fd
=
get_socket_for_af
(
AF_ECONET
);
if
(
fd
>=
0
)
{
s
trcpy
(
ifr
.
ifr_name
,
ifname
);
s
afe_strncpy
(
ifr
.
ifr_name
,
ifname
,
sizeof
(
ifr
.
ifr_name
)
);
if
(
ioctl
(
fd
,
SIOCGIFADDR
,
&
ifr
)
==
0
)
{
ife
->
ecaddr
=
ifr
.
ifr_addr
;
ife
->
has_econet
=
1
;
...
...
lib/ipx_gr.c
View file @
604785ad
...
...
@@ -27,6 +27,7 @@
#include "net-support.h"
#include "pathnames.h"
#include "intl.h"
#include "util.h"
/* UGLY */
...
...
@@ -72,15 +73,15 @@ int IPX_rprint(int options)
/* Fetch and resolve the Destination */
(
void
)
ap
->
input
(
5
,
net
,
&
sa
);
s
trcpy
(
net
,
ap
->
sprint
(
&
sa
,
numeric
));
s
afe_strncpy
(
net
,
ap
->
sprint
(
&
sa
,
numeric
),
sizeof
(
net
));
/* Fetch and resolve the Router Net */
(
void
)
ap
->
input
(
5
,
router_net
,
&
sa
);
s
trcpy
(
router_net
,
ap
->
sprint
(
&
sa
,
numeric
));
s
afe_strncpy
(
router_net
,
ap
->
sprint
(
&
sa
,
numeric
),
sizeof
(
router_net
));
/* Fetch and resolve the Router Node */
(
void
)
ap
->
input
(
2
,
router_node
,
&
sa
);
s
trcpy
(
router_node
,
ap
->
sprint
(
&
sa
,
numeric
));
s
afe_strncpy
(
router_node
,
ap
->
sprint
(
&
sa
,
numeric
),
sizeof
(
router_node
));
printf
(
"%-25s %-25s %-25s
\n
"
,
net
,
router_net
,
router_node
);
}
...
...
lib/rose.c
View file @
604785ad
...
...
@@ -34,6 +34,7 @@
#include "net-support.h"
#include "pathnames.h"
#include "intl.h"
#include "util.h"
#ifndef _NETROSE_ROSE_H
#include <linux/ax25.h>
...
...
@@ -83,7 +84,7 @@ static int ROSE_input(int type, char *bufp, struct sockaddr *sap)
/* Node address the correct length ? */
if
(
strlen
(
bufp
)
!=
10
)
{
s
trcpy
(
ROSE_errmsg
,
_
(
"Node address must be ten digits"
));
s
afe_strncpy
(
ROSE_errmsg
,
_
(
"Node address must be ten digits"
),
sizeof
(
ROSE_errmsg
));
errno
=
EINVAL
;
return
(
-
1
);
}
...
...
nameif.c
View file @
604785ad
...
...
@@ -235,7 +235,7 @@ int main(int ac, char **av)
usage
();
if
(
strlen
(
av
[
optind
])
+
1
>
IFNAMSIZ
)
complain
(
_
(
"interface name `%s' too long"
),
av
[
optind
]);
s
trcpy
(
ch
->
ifname
,
av
[
optind
]
);
s
afe_strncpy
(
ch
->
ifname
,
av
[
optind
],
sizeof
(
ch
->
ifname
)
);
optind
++
;
sprintf
(
pos
,
_
(
"argument %d"
),
optind
);
addchange
(
av
[
optind
],
ch
,
pos
);
...
...
route.c
View file @
604785ad
...
...
@@ -60,6 +60,7 @@
#include "intl.h"
#include "pathnames.h"
#include "version.h"
#include "util.h"
#define DFLT_AF "inet"
...
...
@@ -136,9 +137,9 @@ int main(int argc, char **argv)
/* getopts and -net wont work :-/ */
for
(
tmp
=
argv
;
*
tmp
;
tmp
++
)
{
if
(
!
strcmp
(
*
tmp
,
"-net"
))
s
trcpy
(
*
tmp
,
"#net"
);
s
afe_strncpy
(
*
tmp
,
"#net"
,
sizeof
(
*
tmp
)
);
else
if
(
!
strcmp
(
*
tmp
,
"-host"
))
s
trcpy
(
*
tmp
,
"#host"
);
s
afe_strncpy
(
*
tmp
,
"#host"
,
sizeof
(
*
tmp
)
);
}
/* Fetch the command-line arguments. */
...
...
slattach.c
View file @
604785ad
...
...
@@ -621,7 +621,7 @@ main(int argc, char *argv[])
{
NULL
,
0
,
NULL
,
0
}
};
s
trcpy
(
path_buf
,
""
);
s
afe_strncpy
(
path_buf
,
""
,
sizeof
(
path_buf
)
);
path_dev
=
path_buf
;
/* 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