File xsa178-0020-libxl-Cleanup-use-libxl__backendpath_parse_domid-in-.patch of Package xen.6121

References: bsc#979670 CVE-2016-4963 XSA-178

From 630c29b32b3e7e7c114bd88b6fc6538bacebc533 Mon Sep 17 00:00:00 2001
From: Ian Jackson <ian.jackson@eu.citrix.com>
Date: Fri, 29 Apr 2016 16:08:19 +0100
Subject: [PATCH 20/21] 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 <Ian.Jackson@eu.citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
---
 tools/libxl/libxl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Index: xen-4.4.4-testing/tools/libxl/libxl.c
===================================================================
--- xen-4.4.4-testing.orig/tools/libxl/libxl.c
+++ xen-4.4.4-testing/tools/libxl/libxl.c
@@ -2310,10 +2310,10 @@ static int libxl__device_disk_from_xenst
         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. */
openSUSE Build Service is sponsored by