[Xymon] [Patch] xymond_rrd crash when parsing Linux ifconfig data
Steve Hill
steve at opendium.com
Tue Feb 27 13:28:30 CET 2018
This patch addresses two problems:
1. For Linux clients, do_ifstat_rrd parses the ifconfig output using the
regex:
([a-z0-9]+(_[0-9]+)?:*|lo:?)\s
pickdata() is called like this:
pickdata(bol, ifstat_linux_pcres[0], 1, &ifname)
With a network interface name such as "foo1", the regex produces 2 results:
0: "foo1 "
1: "foo1"
pickdata() discards result 0 and assigns result 1 ("foo1") to the ifname
parameter as expected.
With a network interface name such as "foo_1", the regex produces 3 results:
0: "foo_1 "
1: "foo_1"
2: "_1"
pickdata() discards result 0, assigns result 1 ("foo_1") to the ifname
parameter and then tries to assign result 2 ("_1") to the next parameter
in the variable argument list. Since there it no such parameter, this
results in a segmentation fault and xymond_rrd crashes.
The attached patch adds a "num_args" parameter to pickdata() to tell it
how many arguments are in the variable argument list and ensure it never
rolls off the end of that list.
2. I have some clients with network interface names in the form "foo.5",
"foo_bar" and "foo-bar" ("eth0.5" is especially common when eth0 is
carrying an 802.1q trunk, for example). Xymon does not collect
statistics on those network interfaces because they don't match the
regex. This patch relaxes the regex a bit so that it matches these
network interfaces.
--
- Steve Hill
Technical Director
Opendium Online Safety / Web Filtering http://www.opendium.com
Enquiries: sales at opendium.com +44-1792-824568
Support: support at opendium.com +44-1792-825748
Opendium Limited is a company registered in England and Wales.
Company No. 5465437
Highfield House, 1 Brue Close, Bruton, Somerset, BA10 0HY, England.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: diff-thirdparty_xymon-from-607-to-609.diff
Type: text/x-patch
Size: 6248 bytes
Desc: not available
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20180227/0150b79f/attachment.bin>
More information about the Xymon
mailing list