I have a situation where I use BufferedReader readLine()to read data from a socket, but it readLine()reads data until it finds a new character / line feed character in Data.
And if my data does not contain a new line character, it will continue to read the data until it finds a new line, and the attacker can introduce a DOS attack. And even a socket can expire.
I know that one solution could be to limit the size of the row and read only some data and add data to the buffer.
Is this the best solution, or can I do it another way?
I can override the BufferedReader and override the readLine () method. Is there a possible solution?
source
share