From 509ae901dc25c51553c49e6f4428ac8023b42625 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 29 Apr 2016 16:08:19 +0100 Subject: [PATCH] libxl: Cleanup: use libxl__backendpath_parse_domid in libxl__device_disk_from_xs_be 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 Reviewed-by: Wei Liu --- 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 20a8960562..c0a80cb726 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -2640,10 +2640,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; } /* "params" may not be present; but everything else must be. */ -- 2.39.5