Rather than an open-coded sscanf.  No functional change with correct
input.

This is a followup to XSA-175 and XSA-178.

Signed-off-by: Ian Jackson <ian.jack...@eu.citrix.com>
Reviewed-by: Wei Liu <wei.l...@citrix.com>
---
 tools/libxl/libxl.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index d5475ed..006b83f 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -2658,10 +2658,10 @@ static int libxl__device_disk_from_xenstore(libxl__gc 
*gc,
         goto out;
     }
 
-    rc = sscanf(backend_path, "/local/domain/%d/", &disk->backend_domid);
-    if (rc != 1) {
+    rc = libxl__backendpath_parse_domid(gc, backend_path, 
&disk->backend_domid);
+    if (rc) {
         LOG(ERROR, "Unable to fetch device backend domid from %s", 
backend_path);
-        goto cleanup;
+        goto out;
     }
 
     /*
-- 
1.7.10.4


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

Reply via email to