Fix buffer overflow

Apply the patch from bug 6026, correcting a typo that causes overflows.
master
Florian Rivoal 2010-10-13 09:26:44 +09:00
parent cd6830349d
commit 0f806d5a5a
1 changed files with 3 additions and 3 deletions

View File

@ -101,11 +101,11 @@ int get_stat(netdata* data)
/* do not parse the first two lines as they only contain static garbage */ /* do not parse the first two lines as they only contain static garbage */
fseek(proc_net_dev, 0, SEEK_SET); fseek(proc_net_dev, 0, SEEK_SET);
fgets(buffer, BUFSIZ-1, proc_net_dev); fgets(buffer, BUFSIZE-1, proc_net_dev);
fgets(buffer, BUFSIZ-1, proc_net_dev); fgets(buffer, BUFSIZE-1, proc_net_dev);
interfacefound = 0; interfacefound = 0;
while (fgets(buffer, BUFSIZ-1, proc_net_dev) != NULL) while (fgets(buffer, BUFSIZE-1, proc_net_dev) != NULL)
{ {
/* find the device name and substitute ':' with '\0' */ /* find the device name and substitute ':' with '\0' */
ptr = buffer; ptr = buffer;