]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
security: Fix libvirtd crash possibility
authorMartin Kletzander <mkletzan@redhat.com>
Wed, 12 Sep 2012 21:43:26 +0000 (23:43 +0200)
committerMartin Kletzander <mkletzan@redhat.com>
Fri, 14 Sep 2012 06:13:19 +0000 (08:13 +0200)
Fix for CVE-2012-4423.

When generating RPC protocol messages, it's strictly needed to have a
continuous line of numbers or RPC messages. However in case anyone
tries backporting some functionality and will skip a number, there is
a possibility to make the daemon segfault with newer virsh (version of
the library, rpc call, etc.) even unintentionally.

The problem is that the skipped numbers will get func filled with
NULLs, but there is no check whether these are set before the daemon
tries to run them. This patch very simply enhances one check and fixes
that.

src/rpc/virnetserverprogram.c

index d13b621b625a108bdbd3f5d2b10696ba3f5b424f..95a6d765911fa13e6527df85af7654c39f2cb619 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * virnetserverprogram.c: generic network RPC server program
  *
- * Copyright (C) 2006-2011 Red Hat, Inc.
+ * Copyright (C) 2006-2012 Red Hat, Inc.
  * Copyright (C) 2006 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -109,12 +109,19 @@ int virNetServerProgramMatches(virNetServerProgramPtr prog,
 static virNetServerProgramProcPtr virNetServerProgramGetProc(virNetServerProgramPtr prog,
                                                              int procedure)
 {
+    virNetServerProgramProcPtr proc;
+
     if (procedure < 0)
         return NULL;
     if (procedure >= prog->nprocs)
         return NULL;
 
-    return &prog->procs[procedure];
+    proc = &prog->procs[procedure];
+
+    if (!proc->func)
+        return NULL;
+
+    return proc;
 }
 
 unsigned int