[Libvirt-cim] [PATCH] Fixing NullPointerException

Sharad Mishra snmishra at us.ibm.com
Tue Mar 8 11:51:01 UTC 2011


# HG changeset patch
# User Sharad Mishra <snmishra at us.ibm.com>
# Date 1299548081 28800
# Node ID eea958fbf1d965bc1053850f59df4005e64093ac
# Parent  32ec4dfd813c449501f70e2419cd6f17eee5c673
Fixing NullPointerException

While reading the output of lldptool command the read buffer was going beyond the allocated size and was reading garbage. Added a check to make sure it doesn't go beyond the allocated size.

Signed-off-by: Sharad Mishra <snmishra at us.ibm.com>

diff -r 32ec4dfd813c -r eea958fbf1d9 src/Virt_SwitchService.c
--- a/src/Virt_SwitchService.c	Wed Mar 02 10:09:34 2011 -0800
+++ b/src/Virt_SwitchService.c	Mon Mar 07 17:34:41 2011 -0800
@@ -48,7 +48,8 @@
         const char *searchStr[] = {"	supported forwarding mode: "
                                    "(0x40) reflective relay",
                                    "	supported capabilities: "
-                                   "(0x07) RTE ECP VDP"};
+                                   "(0x07) RTE ECP VDP",
+                                   NULL};
         int  matched = 0;
 
         // Run lldptool command to find vsi support.




More information about the Libvirt-cim mailing list