[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] xenstat: Correct copy of network device name
On Mon, 2012-01-09 at 11:44 +0000, Miroslav Rezanina wrote: > 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. Presumably if some other characters in the name it will still segfault? Can we handle that too? > > 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); > } _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |