-
Bug
-
Resolution: Fixed
-
P3
-
1.1.4
-
1.2beta3
-
sparc
-
solaris_2.5
-
Verified
Name: yyC67448 Date: 11/11/97
The constructor java.net.DatagramPacket(byte[], int) does not check it's second
parameter (length) for negative values.
Here is the test demonstrating the bug:
-------------------------------- Test.java -----------------------------
import java.net.*;
class test
{
public static void main(String args[])
{
DatagramPacket pac = null;
byte[] array = new byte[20];
int len = -10;
try {
pac = new DatagramPacket(array, len);
} catch(IllegalArgumentException e)
{
System.out.println("OKAY");
System.exit(0);
}
catch(Exception e)
{
System.out.println("Failed. Can not create DatagramPacket:" + e);
System.exit(-1);
}
System.out.println("Failed. No Exceptions.");
}
}
---------------------- Output from the test -----------------
Failed. No Exceptions.
-----------------------------------------------------------------
======================================================================