[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen stable-4.2] tools/libxl: Avoid deliberate NULL pointer dereference



commit e4959653e13e2f8a83c9868b08dac0672fe38249
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Mon Nov 25 11:12:50 2013 +0000
Commit:     Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CommitDate: Thu Jan 9 12:38:56 2014 +0000

    tools/libxl: Avoid deliberate NULL pointer dereference
    
    Coverity ID: 1055290
    
    Calling LIBXL__LOG_ERRNO(ctx,) with a ctx pointer we have just failed to
    allocate is going to end badly.  Opencode a suitable use of xtl_log() 
instead.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    CC: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
    Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
    (cherry picked from commit 1677af03c14f2d8d88d2ed9ed8ce6d4906d19fb4)
    (cherry picked from commit 4cbbbdfb775d387dc1e0931b44e14d3205c92265)
---
 tools/libxl/libxl.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 8e191ca..c47d21f 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -32,7 +32,9 @@ int libxl_ctx_alloc(libxl_ctx **pctx, int version,
 
     ctx = malloc(sizeof(*ctx));
     if (!ctx) {
-        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Failed to allocate 
context\n");
+        xtl_log(lg, XTL_ERROR, errno, "libxl",
+                "%s:%d:%s: Failed to allocate context\n",
+                __FILE__, __LINE__, __func__);
         rc = ERROR_NOMEM; goto out;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.2

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.