[ovs-dev] [PATCH 1/3] datapath: Fix argument to strncpy_from_user().

Ben Pfaff blp at nicira.com
Tue Apr 27 17:45:56 UTC 2010


The strncpy_from_user() function's 'count' argument is documented to
include the trailing null byte, but create_dp() did not include it.  This
commit adds it in.
---
 datapath/datapath.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/datapath/datapath.c b/datapath/datapath.c
index e1320f2..be16044 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -203,7 +203,7 @@ static int create_dp(int dp_idx, const char __user *devnamep)
 
 	if (devnamep) {
 		err = -EFAULT;
-		if (strncpy_from_user(devname, devnamep, IFNAMSIZ - 1) < 0)
+		if (strncpy_from_user(devname, devnamep, IFNAMSIZ) < 0)
 			goto err;
 		devname[IFNAMSIZ - 1] = '\0';
 	} else {
-- 
1.6.6.1





More information about the dev mailing list