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
91396556
Commit
91396556
authored
May 25, 2003
by
Ben Collins
Committed by
David S. Miller
May 25, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NET]: strncpy -> strlcpy conversions.
parent
f913f1d9
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
25 additions
and
30 deletions
+25
-30
net/atm/mpoa_proc.c
net/atm/mpoa_proc.c
+1
-1
net/ax25/af_ax25.c
net/ax25/af_ax25.c
+2
-3
net/bridge/br_if.c
net/bridge/br_if.c
+1
-1
net/ipv4/arp.c
net/ipv4/arp.c
+1
-1
net/ipv4/ipconfig.c
net/ipv4/ipconfig.c
+5
-6
net/irda/ircomm/ircomm_lmp.c
net/irda/ircomm/ircomm_lmp.c
+1
-1
net/irda/ircomm/ircomm_ttp.c
net/irda/ircomm/ircomm_ttp.c
+1
-1
net/irda/ircomm/ircomm_tty.c
net/irda/ircomm/ircomm_tty.c
+1
-1
net/irda/irlan/irlan_client.c
net/irda/irlan/irlan_client.c
+1
-1
net/irda/irlan/irlan_common.c
net/irda/irlan/irlan_common.c
+1
-1
net/irda/irlan/irlan_provider.c
net/irda/irlan/irlan_provider.c
+1
-1
net/irda/irlap.c
net/irda/irlap.c
+1
-2
net/irda/irnet/irnet_irda.c
net/irda/irnet/irnet_irda.c
+2
-2
net/irda/irqueue.c
net/irda/irqueue.c
+1
-1
net/irda/irsyms.c
net/irda/irsyms.c
+1
-1
net/packet/af_packet.c
net/packet/af_packet.c
+3
-4
net/wanrouter/af_wanpipe.c
net/wanrouter/af_wanpipe.c
+1
-2
No files found.
net/atm/mpoa_proc.c
View file @
91396556
...
...
@@ -223,7 +223,7 @@ static int parse_qos(const char *buff, int len)
int
value
[
5
];
memset
(
&
qos
,
0
,
sizeof
(
struct
atm_qos
));
str
ncpy
(
cmd
,
buff
,
3
);
str
lcpy
(
cmd
,
buff
,
sizeof
(
cmd
)
);
if
(
strncmp
(
cmd
,
"add"
,
3
)
&&
strncmp
(
cmd
,
"del"
,
3
))
return
0
;
/* not add or del */
...
...
net/ax25/af_ax25.c
View file @
91396556
...
...
@@ -743,9 +743,8 @@ static int ax25_getsockopt(struct socket *sock, int level, int optname,
ax25_dev
=
ax25
->
ax25_dev
;
if
(
ax25_dev
!=
NULL
&&
ax25_dev
->
dev
!=
NULL
)
{
strncpy
(
devname
,
ax25_dev
->
dev
->
name
,
IFNAMSIZ
);
length
=
min_t
(
unsigned
int
,
strlen
(
ax25_dev
->
dev
->
name
)
+
1
,
maxlen
);
devname
[
length
-
1
]
=
'\0'
;
strlcpy
(
devname
,
ax25_dev
->
dev
->
name
,
sizeof
(
devname
));
length
=
strlen
(
devname
)
+
1
;
}
else
{
*
devname
=
'\0'
;
length
=
1
;
...
...
net/bridge/br_if.c
View file @
91396556
...
...
@@ -84,7 +84,7 @@ static struct net_bridge *new_nb(const char *name)
memset
(
br
,
0
,
sizeof
(
*
br
));
dev
=
&
br
->
dev
;
str
ncpy
(
dev
->
name
,
name
,
IFNAMSIZ
);
str
lcpy
(
dev
->
name
,
name
,
sizeof
(
dev
->
name
)
);
dev
->
priv
=
br
;
dev
->
priv_flags
=
IFF_EBRIDGE
;
ether_setup
(
dev
);
...
...
net/ipv4/arp.c
View file @
91396556
...
...
@@ -949,7 +949,7 @@ static int arp_req_get(struct arpreq *r, struct net_device *dev)
r
->
arp_flags
=
arp_state_to_flags
(
neigh
);
read_unlock_bh
(
&
neigh
->
lock
);
r
->
arp_ha
.
sa_family
=
dev
->
type
;
str
n
cpy
(
r
->
arp_dev
,
dev
->
name
,
sizeof
(
r
->
arp_dev
));
str
l
cpy
(
r
->
arp_dev
,
dev
->
name
,
sizeof
(
r
->
arp_dev
));
neigh_release
(
neigh
);
err
=
0
;
}
...
...
net/ipv4/ipconfig.c
View file @
91396556
...
...
@@ -1363,16 +1363,15 @@ static int __init ip_auto_config_setup(char *addrs)
case
4
:
if
((
dp
=
strchr
(
ip
,
'.'
)))
{
*
dp
++
=
'\0'
;
str
ncpy
(
system_utsname
.
domainname
,
dp
,
__NEW_UTS_LEN
);
system_utsname
.
domainname
[
__NEW_UTS_LEN
]
=
'\0'
;
str
lcpy
(
system_utsname
.
domainname
,
dp
,
sizeof
(
system_utsname
.
domainname
))
;
}
str
ncpy
(
system_utsname
.
nodename
,
ip
,
__NEW_UTS_LEN
);
system_utsname
.
nodename
[
__NEW_UTS_LEN
]
=
'\0'
;
str
lcpy
(
system_utsname
.
nodename
,
ip
,
sizeof
(
system_utsname
.
nodename
))
;
ic_host_name_set
=
1
;
break
;
case
5
:
strncpy
(
user_dev_name
,
ip
,
IFNAMSIZ
);
user_dev_name
[
IFNAMSIZ
-
1
]
=
'\0'
;
strlcpy
(
user_dev_name
,
ip
,
sizeof
(
user_dev_name
));
break
;
case
6
:
ic_proto_name
(
ip
);
...
...
net/irda/ircomm/ircomm_lmp.c
View file @
91396556
...
...
@@ -60,7 +60,7 @@ int ircomm_open_lsap(struct ircomm_cb *self)
notify
.
connect_indication
=
ircomm_lmp_connect_indication
;
notify
.
disconnect_indication
=
ircomm_lmp_disconnect_indication
;
notify
.
instance
=
self
;
str
ncpy
(
notify
.
name
,
"IrCOMM"
,
NOTIFY_MAX_NAME
);
str
lcpy
(
notify
.
name
,
"IrCOMM"
,
sizeof
(
notify
.
name
)
);
self
->
lsap
=
irlmp_open_lsap
(
LSAP_ANY
,
&
notify
,
0
);
if
(
!
self
->
lsap
)
{
...
...
net/irda/ircomm/ircomm_ttp.c
View file @
91396556
...
...
@@ -60,7 +60,7 @@ int ircomm_open_tsap(struct ircomm_cb *self)
notify
.
flow_indication
=
ircomm_ttp_flow_indication
;
notify
.
disconnect_indication
=
ircomm_ttp_disconnect_indication
;
notify
.
instance
=
self
;
str
ncpy
(
notify
.
name
,
"IrCOMM"
,
NOTIFY_MAX_NAME
);
str
lcpy
(
notify
.
name
,
"IrCOMM"
,
sizeof
(
notify
.
name
)
);
self
->
tsap
=
irttp_open_tsap
(
LSAP_ANY
,
DEFAULT_INITIAL_CREDIT
,
&
notify
);
...
...
net/irda/ircomm/ircomm_tty.c
View file @
91396556
...
...
@@ -205,7 +205,7 @@ static int ircomm_tty_startup(struct ircomm_tty_cb *self)
notify
.
disconnect_indication
=
ircomm_tty_disconnect_indication
;
notify
.
connect_confirm
=
ircomm_tty_connect_confirm
;
notify
.
connect_indication
=
ircomm_tty_connect_indication
;
str
ncpy
(
notify
.
name
,
"ircomm_tty"
,
NOTIFY_MAX_NAME
);
str
lcpy
(
notify
.
name
,
"ircomm_tty"
,
sizeof
(
notify
.
name
)
);
notify
.
instance
=
self
;
if
(
!
self
->
ircomm
)
{
...
...
net/irda/irlan/irlan_client.c
View file @
91396556
...
...
@@ -268,7 +268,7 @@ void irlan_client_open_ctrl_tsap(struct irlan_cb *self)
notify
.
connect_confirm
=
irlan_client_ctrl_connect_confirm
;
notify
.
disconnect_indication
=
irlan_client_ctrl_disconnect_indication
;
notify
.
instance
=
self
;
str
ncpy
(
notify
.
name
,
"IrLAN ctrl (c)"
,
NOTIFY_MAX_NAME
);
str
lcpy
(
notify
.
name
,
"IrLAN ctrl (c)"
,
sizeof
(
notify
.
name
)
);
tsap
=
irttp_open_tsap
(
LSAP_ANY
,
DEFAULT_INITIAL_CREDIT
,
&
notify
);
if
(
!
tsap
)
{
...
...
net/irda/irlan/irlan_common.c
View file @
91396556
...
...
@@ -465,7 +465,7 @@ void irlan_open_data_tsap(struct irlan_cb *self)
/*notify.flow_indication = irlan_eth_flow_indication;*/
notify
.
disconnect_indication
=
irlan_disconnect_indication
;
notify
.
instance
=
self
;
str
ncpy
(
notify
.
name
,
"IrLAN data"
,
NOTIFY_MAX_NAME
);
str
lcpy
(
notify
.
name
,
"IrLAN data"
,
sizeof
(
notify
.
name
)
);
tsap
=
irttp_open_tsap
(
LSAP_ANY
,
DEFAULT_INITIAL_CREDIT
,
&
notify
);
if
(
!
tsap
)
{
...
...
net/irda/irlan/irlan_provider.c
View file @
91396556
...
...
@@ -396,7 +396,7 @@ int irlan_provider_open_ctrl_tsap(struct irlan_cb *self)
notify
.
connect_indication
=
irlan_provider_connect_indication
;
notify
.
disconnect_indication
=
irlan_provider_disconnect_indication
;
notify
.
instance
=
self
;
str
ncpy
(
notify
.
name
,
"IrLAN ctrl (p)"
,
16
);
str
lcpy
(
notify
.
name
,
"IrLAN ctrl (p)"
,
sizeof
(
notify
.
name
)
);
tsap
=
irttp_open_tsap
(
LSAP_ANY
,
1
,
&
notify
);
if
(
!
tsap
)
{
...
...
net/irda/irlap.c
View file @
91396556
...
...
@@ -122,8 +122,7 @@ struct irlap_cb *irlap_open(struct net_device *dev, struct qos_info *qos,
self
->
qos_dev
=
qos
;
/* Copy hardware name */
if
(
hw_name
!=
NULL
)
{
strncpy
(
self
->
hw_name
,
hw_name
,
2
*
IFNAMSIZ
);
self
->
hw_name
[
2
*
IFNAMSIZ
]
=
'\0'
;
strlcpy
(
self
->
hw_name
,
hw_name
,
sizeof
(
self
->
hw_name
));
}
else
{
self
->
hw_name
[
0
]
=
'\0'
;
}
...
...
net/irda/irnet/irnet_irda.c
View file @
91396556
...
...
@@ -114,7 +114,7 @@ irnet_open_tsap(irnet_socket * self)
notify
.
flow_indication
=
irnet_flow_indication
;
notify
.
status_indication
=
irnet_status_indication
;
notify
.
instance
=
self
;
str
ncpy
(
notify
.
name
,
IRNET_NOTIFY_NAME
,
NOTIFY_MAX_NAME
);
str
lcpy
(
notify
.
name
,
IRNET_NOTIFY_NAME
,
sizeof
(
notify
.
name
)
);
/* Open an IrTTP instance */
self
->
tsap
=
irttp_open_tsap
(
LSAP_ANY
,
DEFAULT_INITIAL_CREDIT
,
...
...
@@ -692,7 +692,7 @@ irnet_daddr_to_dname(irnet_socket * self)
if
(
discoveries
[
i
].
daddr
==
self
->
daddr
)
{
/* Yes !!! Get it.. */
str
ncpy
(
self
->
rname
,
discoveries
[
i
].
info
,
NICKNAME_MAX_LEN
);
str
lcpy
(
self
->
rname
,
discoveries
[
i
].
info
,
sizeof
(
self
->
rname
)
);
self
->
rname
[
NICKNAME_MAX_LEN
+
1
]
=
'\0'
;
DEBUG
(
IRDA_SERV_INFO
,
"Device 0x%08x is in fact ``%s''.
\n
"
,
self
->
daddr
,
self
->
rname
);
...
...
net/irda/irqueue.c
View file @
91396556
...
...
@@ -594,7 +594,7 @@ void hashbin_insert(hashbin_t* hashbin, irda_queue_t* entry, long hashv, char* n
*/
entry
->
q_hash
=
hashv
;
if
(
name
)
str
ncpy
(
entry
->
q_name
,
name
,
32
);
str
lcpy
(
entry
->
q_name
,
name
,
sizeof
(
entry
->
q_name
)
);
/*
* Insert new entry first
...
...
net/irda/irsyms.c
View file @
91396556
...
...
@@ -250,7 +250,7 @@ void irda_notify_init(notify_t *notify)
notify
->
flow_indication
=
NULL
;
notify
->
status_indication
=
NULL
;
notify
->
instance
=
NULL
;
str
ncpy
(
notify
->
name
,
"Unknown"
,
NOTIFY_MAX_NAME
);
str
lcpy
(
notify
->
name
,
"Unknown"
,
sizeof
(
notify
->
name
)
);
}
/*
...
...
net/packet/af_packet.c
View file @
91396556
...
...
@@ -255,7 +255,7 @@ static int packet_rcv_spkt(struct sk_buff *skb, struct net_device *dev, struct
*/
spkt
->
spkt_family
=
dev
->
type
;
str
n
cpy
(
spkt
->
spkt_device
,
dev
->
name
,
sizeof
(
spkt
->
spkt_device
));
str
l
cpy
(
spkt
->
spkt_device
,
dev
->
name
,
sizeof
(
spkt
->
spkt_device
));
spkt
->
spkt_protocol
=
skb
->
protocol
;
/*
...
...
@@ -878,8 +878,7 @@ static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, int add
if
(
addr_len
!=
sizeof
(
struct
sockaddr
))
return
-
EINVAL
;
strncpy
(
name
,
uaddr
->
sa_data
,
14
);
name
[
14
]
=
0
;
strlcpy
(
name
,
uaddr
->
sa_data
,
sizeof
(
name
));
dev
=
dev_get_by_name
(
name
);
if
(
dev
)
{
...
...
@@ -1096,7 +1095,7 @@ static int packet_getname_spkt(struct socket *sock, struct sockaddr *uaddr,
uaddr
->
sa_family
=
AF_PACKET
;
dev
=
dev_get_by_index
(
pkt_sk
(
sk
)
->
ifindex
);
if
(
dev
)
{
str
n
cpy
(
uaddr
->
sa_data
,
dev
->
name
,
15
);
str
l
cpy
(
uaddr
->
sa_data
,
dev
->
name
,
15
);
dev_put
(
dev
);
}
else
memset
(
uaddr
->
sa_data
,
0
,
14
);
...
...
net/wanrouter/af_wanpipe.c
View file @
91396556
...
...
@@ -1408,8 +1408,7 @@ static int wanpipe_bind(struct socket *sock, struct sockaddr *uaddr, int addr_le
/* Bind a socket to a interface name
* This is used by PVC mostly
*/
strncpy
(
name
,
sll
->
sll_device
,
14
);
name
[
14
]
=
0
;
strlcpy
(
name
,
sll
->
sll_device
,
sizeof
(
name
));
dev
=
dev_get_by_name
(
name
);
if
(
dev
==
NULL
){
printk
(
KERN_INFO
"wansock: Failed to get Dev from name: %s,
\n
"
,
...
...
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