[Nagios-devel] Minor bug : unreachable code in the nsca daemon

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[Nagios-devel] Minor bug : unreachable code in the nsca daemon

Post by Guest »

The problem :

(all line numbers will be refering to the nsca.c file v. 2.1)

nsca.c handles the case of not receiving all expected data between
lines 871 and 880 (message 'Data sent from client was too short').
But this code is unreachable, in my opinion.

If the 'recvall' function (netutils.c) doesn't receive all
expected data, it's return value will be 0 (stored in the 'rc'
variable at line 857). Then the condition at line 860 (
'if(rc<=3D0){' ) causes bailing out with the message 'End of
connection or could not read request from client', what renders
the following defensive code (871-880) unreachable.

The suggested fix (too trivial to make a patch) then would be:
replace the condition at line 860 with this: 'if(rc<0){'

Am I right?

Zdenek Svoboda

--------------------
Centrum pro milovn=EDky pen=ECz http://finance.centrum.cz








This post was automatically imported from historical nagios-devel mailing list archives
Original poster: zdenek.svoboda@centrum.cz
Locked