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

[Xen-changelog] [xen staging] libxl: add initializers for libxl__domid_history



commit d7d751bfdbd4424e286eddfa0ce36075627e3c31
Author:     Paul Durrant <pdurrant@xxxxxxxxxx>
AuthorDate: Wed Feb 26 13:12:13 2020 +0000
Commit:     Wei Liu <wl@xxxxxxx>
CommitDate: Wed Feb 26 21:48:39 2020 +0000

    libxl: add initializers for libxl__domid_history
    
    This patch fixes Coverity issue CID 1459006 (Insecure data handling
    (INTEGER_OVERFLOW)).
    
    The problem is that the error paths for libxl__mark_domid_recent() and
    libxl__is_domid_recent() check the 'f' field in struct libxl__domid_history
    when it may not have been initialized.
    
    Signed-off-by: Paul Durrant <pdurrant@xxxxxxxxxx>
    Acked-by: Wei Liu <wl@xxxxxxx>
---
 tools/libxl/libxl_domain.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/libxl_domain.c b/tools/libxl/libxl_domain.c
index 8937aeb260..41d08394f3 100644
--- a/tools/libxl/libxl_domain.c
+++ b/tools/libxl/libxl_domain.c
@@ -1390,7 +1390,7 @@ static int libxl__read_recent(libxl__gc *gc,
 static int libxl__mark_domid_recent(libxl__gc *gc, uint32_t domid)
 {
     libxl__flock *lock;
-    struct libxl__domid_history ctxt;
+    struct libxl__domid_history ctxt = {};
     char *new;
     FILE *nf = NULL;
     int r, rc;
@@ -1461,7 +1461,7 @@ out:
 
 int libxl__is_domid_recent(libxl__gc *gc, uint32_t domid, bool *recent)
 {
-    struct libxl__domid_history ctxt;
+    struct libxl__domid_history ctxt = {};
     int rc;
 
     rc = libxl__open_domid_history(gc, &ctxt);
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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