Message ID | 1461161795-28948-1-git-send-email-zhigang.x.wang@oracle.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Wed, Apr 20, 2016 at 10:16:35AM -0400, Zhigang Wang wrote: > xentop will segmentation fault in this case: > > # ip link set eth1 down > # ip link set eth1 name ETH > # xentop > > This patch will let xentop to handle all uppercase network interface name. > > Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com> Acked-by: Wei Liu <wei.liu2@citrix.com> This fixes a real problem and is not possible to block the pushgate, so: Release-acked-by: Wei Liu <wei.liu2@citrix.com> > --- > tools/xenstat/libxenstat/src/xenstat_linux.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/tools/xenstat/libxenstat/src/xenstat_linux.c b/tools/xenstat/libxenstat/src/xenstat_linux.c > index 2cc9c7f..907d65f 100644 > --- a/tools/xenstat/libxenstat/src/xenstat_linux.c > +++ b/tools/xenstat/libxenstat/src/xenstat_linux.c > @@ -219,8 +219,11 @@ int parseNetDevLine(char *line, char *iface, unsigned long long *rxBytes, unsign > } > else > /* There were errors when parsing this directly in RE. strpbrk() helps */ > - if (iface != NULL) > - strcpy(iface, strpbrk(tmp, "abcdefghijklmnopqrstvuwxyz0123456789")); > + if (iface != NULL) { > + char *tmp2 = strpbrk(tmp, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); > + if (tmp2 != NULL) > + strcpy(iface, tmp2); > + } > > memset(tmp, 0, matches[i].rm_eo - matches[i].rm_so); > } > -- > 2.5.5 >
On Wed, Apr 20, 2016 at 04:12:59PM +0100, Wei Liu wrote: > On Wed, Apr 20, 2016 at 10:16:35AM -0400, Zhigang Wang wrote: > > xentop will segmentation fault in this case: > > > > # ip link set eth1 down > > # ip link set eth1 name ETH > > # xentop > > > > This patch will let xentop to handle all uppercase network interface name. > > > > Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com> > > Acked-by: Wei Liu <wei.liu2@citrix.com> > > This fixes a real problem and is not possible to block the pushgate, so: > > Release-acked-by: Wei Liu <wei.liu2@citrix.com> > Applied.
diff --git a/tools/xenstat/libxenstat/src/xenstat_linux.c b/tools/xenstat/libxenstat/src/xenstat_linux.c index 2cc9c7f..907d65f 100644 --- a/tools/xenstat/libxenstat/src/xenstat_linux.c +++ b/tools/xenstat/libxenstat/src/xenstat_linux.c @@ -219,8 +219,11 @@ int parseNetDevLine(char *line, char *iface, unsigned long long *rxBytes, unsign } else /* There were errors when parsing this directly in RE. strpbrk() helps */ - if (iface != NULL) - strcpy(iface, strpbrk(tmp, "abcdefghijklmnopqrstvuwxyz0123456789")); + if (iface != NULL) { + char *tmp2 = strpbrk(tmp, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); + if (tmp2 != NULL) + strcpy(iface, tmp2); + } memset(tmp, 0, matches[i].rm_eo - matches[i].rm_so); }
xentop will segmentation fault in this case: # ip link set eth1 down # ip link set eth1 name ETH # xentop This patch will let xentop to handle all uppercase network interface name. Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com> --- tools/xenstat/libxenstat/src/xenstat_linux.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)