[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] mini-os: fix nodename generation in init_netfront



commit 3e7da90205a08b9ab31f4ada97c2d5bab491c2ec
Author:     Matthew Daley <mattjd@xxxxxxxxx>
AuthorDate: Wed Sep 18 15:37:57 2013 +1200
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Sat Sep 21 16:41:42 2013 +0100

    mini-os: fix nodename generation in init_netfront
    
    Using strlen here makes no sense.
    
    Coverity-ID: 1056053
    Signed-off-by: Matthew Daley <mattjd@xxxxxxxxx>
    Acked-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
---
 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 4e087a5..a999985 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)
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.