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

[Xen-devel] [PATCH] xenstat: Correct copy of network device name


  • To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: Miroslav Rezanina <mrezanin@xxxxxxxxxx>
  • Date: Mon, 09 Jan 2012 06:44:22 -0500 (EST)
  • Delivery-date: Mon, 09 Jan 2012 11:44:41 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

When xenstat library parse /proc/net/dev, it uses strpbrk function to get 
pointer
to device name. However, it miss capital letters in the array of valid 
characters
so it get incorrect name in case device name starts with capital letters or even
segfault if it contains only capital letters.

This patch adds missing characters to strpbrk call.

Signed-off-by: Miroslav Rezanina <mrezanin@xxxxxxxxxx>

diff -r 4086e4811547 tools/xenstat/libxenstat/src/xenstat_linux.c
--- a/tools/xenstat/libxenstat/src/xenstat_linux.c      Thu Jan 05 17:25:23 
2012 +0000
+++ b/tools/xenstat/libxenstat/src/xenstat_linux.c      Mon Jan 09 12:40:05 
2012 +0100
@@ -222,7 +222,7 @@
                                else
                                /* There were errors when parsing this directly 
in RE. strpbrk() helps */
                                if (iface != NULL)
-                                       strcpy(iface, strpbrk(tmp, 
"abcdefghijklmnopqrstvuwxyz0123456789"));
+                                       strcpy(iface, strpbrk(tmp, 
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"));
 
                                memset(tmp, 0, matches[i].rm_eo - 
matches[i].rm_so);
                        }
-- 
Miroslav Rezanina
Software Engineer - Virtualization Team - XEN kernel


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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