开发者

Do I need to prepare any security procedures using a JTextField

开发者 https://www.devze.com 2023-02-09 15:37 出处:网络
I have a JTextField in a GUI Java App. It\'s not connected to a Database so I\'m not worried about SQL injection or anything like th开发者_运维百科at, but I wonder if I need to worry about a stack ove

I have a JTextField in a GUI Java App. It's not connected to a Database so I'm not worried about SQL injection or anything like th开发者_运维百科at, but I wonder if I need to worry about a stack overflow or another problem.

For example if the user decides to hold his finger on "A" ad nauseum. My Java reference book offered no procedures to prevent misuse of the application like this.


Each key-press produces a KeyEvent, which (over some steps) is translated to a call to insert the text in the Document of your JTextField. If the user inputs really really much text (many megabytes) (then more probably by cut'n'paste), you could get an OutOfMemory error, but this is still nothing that damages you, only the user, since he can't work with the application.

So, nothing really Security-relevant here.


You should be fine with the text field from a security standpoint. I would suggest worrying more about what the code does with the text or in response to the text. SQL injection being one of the most common concerns.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号