sizeof is wrongly used in libxl_write_exactly function, using
strlen instead.

CID: 1358110
CID: 1358109

Signed-off-by: Chunyan Liu <cy...@suse.com>
CC: Simon Cao <caobosi...@gmail.com>
CC: George Dunlap <george.dun...@citrix.com>
CC: Ian Jackson <ian.jack...@eu.citrix.com>
---
 tools/libxl/libxl_pvusb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/libxl_pvusb.c b/tools/libxl/libxl_pvusb.c
index 04e41b4..45117cf 100644
--- a/tools/libxl/libxl_pvusb.c
+++ b/tools/libxl/libxl_pvusb.c
@@ -1025,7 +1025,7 @@ static int unbind_usbintf(libxl__gc *gc, const char *intf)
         goto out;
     }
 
-    if (libxl_write_exactly(CTX, fd, intf, sizeof(intf), path, intf)) {
+    if (libxl_write_exactly(CTX, fd, intf, strlen(intf), path, intf)) {
         rc = ERROR_FAIL;
         goto out;
     }
@@ -1065,7 +1065,7 @@ static int bind_usbintf(libxl__gc *gc, const char *intf, 
const char *drvpath)
         goto out;
     }
 
-    if (libxl_write_exactly(CTX, fd, intf, sizeof(intf), path, intf)) {
+    if (libxl_write_exactly(CTX, fd, intf, strlen(intf), path, intf)) {
         rc = ERROR_FAIL;
         goto out;
     }
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to