wmifs: Add BUFFER_SIZE constant.
commit3bd48a06c5d35d25b6b72d48cb2df5ca4873ec5a
authorDoug Torrance <dtorrance@monmouthcollege.edu>
Wed, 22 Oct 2014 21:34:29 +0000 (22 16:34 -0500)
committerCarlos R. Mafra <crmafra@gmail.com>
Thu, 23 Oct 2014 07:03:31 +0000 (23 08:03 +0100)
tree7d9f17709063c0f01a2fa24779c0111d658c08b7
parent3e9e54c1e4057045fbe64bb6548bee2dd148f39f
wmifs: Add BUFFER_SIZE constant.

Patch by Stephen Pitts <smpitts@midsouth.rr.com>.  First appeared in Debian
package version 1.3b1-4.

From https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=41746:

wmifs started crashing on startup on my system,
so I grabbed the source, added -g to the
Makefile, and ran it through gdb.
(Wow, the wonders of Open Source!!).

I found out that it has the hard-coded assumption
that a line in  /proc/net/dev will be no longer
than 128 bytes. Since my ethernet card has over
1 GB in traffic , my eth0 line was 129 bytes long.
I added a new constant, BUFFER_SIZE, that
determines the size of the buffer used for fgets.

Right now, its at 512 bytes, so that gives it
a large margin of error, until we have petabyte
Ethernet! The patch is attached.
wmifs/wmifs/wmifs.c