[Nagiosplug-devel] Segmentation fault (int pos) in check_procs

Баталов Григорий gbatalov at crystals.ru
Tue Aug 10 18:16:00 CEST 2010


Hello!
I've found the clause in nagios-plugins-1.4.15/plugins/check_procs.c:

int pos; /* number of spaces before 'args' in `ps` output */
...
if ( cols >= expected_cols ) {
   resultsum = 0;
   asprintf (&procargs, "%s", input_line + pos);
   strip (procargs);
...

So I wonder how this variable (pos) is supposed to be initialized.
On my system (tinycore linux 3.0) it gives different huge numbers
like 166949407, 166949462, etc. and corresponding asprintf segfaults.
Should I explicitly initialize it with "int pos=0;" or something?

-- 
Grigory Batalov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20100810/63776c56/attachment.html>


More information about the Devel mailing list