Thread (6 messages) 6 messages, 2 authors, 2024-12-18

Re: [PATCH net] xfrm: prevent some integer overflows in verify_ functions

From: Dan Carpenter <hidden>
Date: 2024-12-17 12:32:36
Also in: kernel-janitors, lkml

On Tue, Dec 17, 2024 at 08:03:38PM +0800, Herbert Xu wrote:
On Tue, Dec 17, 2024 at 11:42:31AM +0300, Dan Carpenter wrote:
quoted
+	if (algp->alg_key_len > INT_MAX) {
Why not check for UINT_MAX - 7? INT_MAX seems a bit arbitrary.
That seems like basic algebra but we have a long history of getting
integer overflow checks wrong so these days I like to just use
INT_MAX where ever I can.  I wanted to use USHRT_MAX. We aren't allowed
to use more than USHRT_MAX bytes, but maybe we're allowed USHRT_MAX
bits, so I didn't do that.

regards,
dan carpenter
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help