diff options
author | Matthew Daley <mattjd@gmail.com> | 2013-09-18 15:37:57 +1200 |
---|---|---|
committer | Ian Campbell <ian.campbell@citrix.com> | 2013-09-21 16:41:42 +0100 |
commit | 3e7da90205a08b9ab31f4ada97c2d5bab491c2ec (patch) | |
tree | 09263483dfb2f3b2b3f7d5f6cb18390210dbdac0 /extras | |
parent | 7b3c792a0f65391b7c115a81f292ecff9bf151e6 (diff) | |
download | xen-3e7da90205a08b9ab31f4ada97c2d5bab491c2ec.tar.gz xen-3e7da90205a08b9ab31f4ada97c2d5bab491c2ec.tar.bz2 xen-3e7da90205a08b9ab31f4ada97c2d5bab491c2ec.zip |
mini-os: fix nodename generation in init_netfront
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>
Diffstat (limited to 'extras')
-rw-r--r-- | extras/mini-os/netfront.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/extras/mini-os/netfront.c b/extras/mini-os/netfront.c index 4e087a56ed..a999985575 100644 --- 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) |