[jcifs] some possible bugs

Cezary Dendek cezary.dendek at javart.com.pl
Tue Aug 26 12:45:15 GMT 2008


Hello.

 During quick check of jcifs source code (bundled with 1.2.24 library)
with static code analyser (FindBugs) it has found some pretty suspicious
lines (which may introduce some tiny bugs):

* jcifs.netbios.NameServicePacket.toString()
** line 277 & 295 - possible lack of 'break'
        switch( questionType ) {
            case NB:
                questionTypeString = "NB";
            case NBSTAT:
                questionTypeString = "NBSTAT";
            default:
                questionTypeString = "0x" + Hexdump.toHexString(
questionType, 4 );
        }

* jcifs.UniAddress
** line 273 - String comp. using == (for performance reasons string
reference comp. can be left, but after 'hostname.length() > 15' it should
be added: '|| NbtAddress.MASTER_BROWSER_NAME.equals(hostname)')

                    case RESOLVER_WINS:
                        if( hostname == NbtAddress.MASTER_BROWSER_NAME ||
                                                    hostname.length() > 15
) {
                                                    // invalid netbios name
                            continue;
                        }



Regards,

Cezary Dendek

----------------------------
JAVART Sp. z o.o.
Al. J. Ch. Szucha 8
00-582 Warsaw
http://www.javart.com.pl




More information about the jcifs mailing list