projects
/
xen.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7b3c792
)
mini-os: fix nodename generation in init_netfront
author
Matthew Daley
<mattjd@gmail.com>
Wed, 18 Sep 2013 03:37:57 +0000
(15:37 +1200)
committer
Ian Campbell
<ian.campbell@citrix.com>
Sat, 21 Sep 2013 15:41:42 +0000
(16:41 +0100)
Using strlen here makes no sense.
Coverity-ID:
1056053
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
extras/mini-os/netfront.c
patch
|
blob
|
history
diff --git
a/extras/mini-os/netfront.c
b/extras/mini-os/netfront.c
index 4e087a56ed86ea5157bbf35d067826ca447d3b55..a9999855758c7885c6f69e1335ea356fcb5c4665 100644
(file)
--- a/
extras/mini-os/netfront.c
+++ b/
extras/mini-os/netfront.c
@@
-309,8
+309,10
@@
struct netfront_dev *init_netfront(char *_nodename, void (*thenetif_rx)(unsigned
if (!_nodename)
snprintf(nodename, sizeof(nodename), "device/vif/%d", netfrontends);
- else
- strncpy(nodename, _nodename, strlen(nodename));
+ else {
+ strncpy(nodename, _nodename, sizeof(nodename) - 1);
+ nodename[sizeof(nodename) - 1] = 0;
+ }
netfrontends++;
if (!thenetif_rx)