Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#3 Unreachable code in libircclient.c

latest_version
open
nobody
None
1
2012-08-01
2012-08-01
Robrecht Dewaele
No

While adding debug code to the source I noticed the following code in libircclient.c:

885 if ( length < 0 )
886 {
887 if ( session->lasterror == 0 )
888 session->lasterror = (length == 0 ? LIBIRC_ERR_CLOSED : LIBIRC_ERR_TERMINATED);

The code on line 888 tests 'length == 0', but it resides in the consequence block of an if statement which tests for 'length < 0'. Therefore, 'LIBIRC_ERR_CLOSED' can never be assigned to 'session->lasterror'.

I double checked this against the following version in SVN:
http://libircclient.svn.sourceforge.net/viewvc/libircclient/trunk/libircclient/src/libircclient.c?revision=111&content-type=text/plain

Discussion

    • priority: 5 --> 1