|
Lines 169-174
static int parseNetDevLine(char *line, c
Link Here
|
| 169 |
matches[i].rm_so + 1) * sizeof(char)); |
169 |
matches[i].rm_so + 1) * sizeof(char)); |
| 170 |
for (x = matches[i].rm_so; x < matches[i].rm_eo; x++) |
170 |
for (x = matches[i].rm_so; x < matches[i].rm_eo; x++) |
| 171 |
tmp[x - matches[i].rm_so] = line[x]; |
171 |
tmp[x - matches[i].rm_so] = line[x]; |
|
|
172 |
tmp[x - matches[i].rm_so] = 0; |
| 172 |
|
173 |
|
| 173 |
/* We populate all the fields from /proc/net/dev line */ |
174 |
/* We populate all the fields from /proc/net/dev line */ |
| 174 |
if (i > 1) { |
175 |
if (i > 1) { |
|
Lines 225-239
static int parseNetDevLine(char *line, c
Link Here
|
| 225 |
break; |
226 |
break; |
| 226 |
} |
227 |
} |
| 227 |
} |
228 |
} |
| 228 |
else |
229 |
else if (iface != NULL) { |
| 229 |
/* There were errors when parsing this directly in RE. strpbrk() helps */ |
|
|
| 230 |
if (iface != NULL) { |
| 231 |
char *tmp2 = strpbrk(tmp, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); |
230 |
char *tmp2 = strpbrk(tmp, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); |
| 232 |
if (tmp2 != NULL) |
231 |
if (tmp2 != NULL) |
| 233 |
strcpy(iface, tmp2); |
232 |
strcpy(iface, tmp2); |
| 234 |
} |
233 |
} |
| 235 |
|
|
|
| 236 |
memset(tmp, 0, matches[i].rm_eo - matches[i].rm_so); |
| 237 |
} |
234 |
} |
| 238 |
} |
235 |
} |
| 239 |
} |
236 |
} |