Skip to contentSkip to conversation

tools/xenstat: handle network interface name in upper case.

PATCH In review Zhigang Wang 1 participant 2 messages Mar 11, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/xenstat: handle network interface name in upper case.

Oracle-Bug: 22879856

---
 tools/xenstat/libxenstat/src/xenstat_linux.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
tools/xenstat/libxenstat/src/xenstat_linux.c +6 -2
index 931b24e..d33eca1 100644
@@ -101,6 +101,7 @@ int parseNetDevLine(char *line, char *iface, unsigned long long *rxBytes, unsign
 	/* Temporary/helper variables */
 	int ret;
 	char *tmp;
+	char *tmp2;
 	int i = 0, x = 0, col = 0;
 	regex_t r;
 	regmatch_t matches[19];
@@ -221,8 +222,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) {
+					tmp2 = strpbrk(tmp, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
+					if (tmp2 != NULL)
+						strcpy(iface, tmp2);
+				}
 
 				memset(tmp, 0, matches[i].rm_eo - matches[i].rm_so);
 			}
Signature · 7 lines
2.5.0


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#1 lore raw

Sorry I send this mail by mistake. Please ignore it. I send another one with correct commit message.

Quoted 24 lines · Zhigang Wang

Oracle-Bug: 22879856

---
 tools/xenstat/libxenstat/src/xenstat_linux.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
tools/xenstat/libxenstat/src/xenstat_linux.c +1 -0
index 931b24e..d33eca1 100644
@@ -101,6 +101,7 @@ int parseNetDevLine(char *line, char *iface, unsigned long long *rxBytes, unsign
 	/* Temporary/helper variables */
 	int ret;
 	char *tmp;
+	char *tmp2;
 	int i = 0, x = 0, col = 0;
 	regex_t r;
 	regmatch_t matches[19];
@@ -221,8 +222,11 @@ int parseNetDevLine(char *line, char *iface, unsigned long long *rxBytes, unsign
 				}
 				else
 				/* There were errors when parsing this directly in RE. strpbrk() helps */

tools/xenstat/libxenstat/src/xenstat_linux.c int parseNetDevLine(char *line, char *iface, unsigned long long *rxBytes, unsign · line 232

Quoted 10 lines
tools/xenstat/libxenstat/src/xenstat_linux.c +5 -2
-				if (iface != NULL)
-					strcpy(iface, strpbrk(tmp, "abcdefghijklmnopqrstvuwxyz0123456789"));
+				if (iface != NULL) {
+					tmp2 = strpbrk(tmp, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
+					if (tmp2 != NULL)
+						strcpy(iface, tmp2);
+				}
 
 				memset(tmp, 0, matches[i].rm_eo - matches[i].rm_so);
 			}

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel