[jcifs] some possible bugs

Michael B Allen ioplex at gmail.com
Tue Aug 26 15:31:54 GMT 2008


On Tue, Aug 26, 2008 at 8:45 AM, Cezary Dendek
<cezary.dendek at javart.com.pl> wrote:
> 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 );
>        }

Indeed, there were a bunch of missing break statements. Fortunately
this was in harmless debugging output.

> * 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;
>                        }

This one's bogus tho.

Thanks,
Mike

-- 
Michael B Allen
PHP Active Directory SPNEGO SSO
http://www.ioplex.com/


More information about the jcifs mailing list