Skip to content

Commit 94fd446

Browse files
committed
fortify: Fix incorrect reporting of read buffer size
When FORTIFY_SOURCE reports about a run-time buffer overread, the wrong buffer size was being shown in the error message. (The bounds checking was correct.) Fixes: 3d965b3 ("fortify: Improve buffer overflow reporting") Reviewed-by: Gustavo A. R. Silva <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Kees Cook <[email protected]>
1 parent fc525d6 commit 94fd446

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/linux/fortify-string.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ __FORTIFY_INLINE bool fortify_memcpy_chk(__kernel_size_t size,
596596
if (p_size != SIZE_MAX && p_size < size)
597597
fortify_panic(func, FORTIFY_WRITE, p_size, size, true);
598598
else if (q_size != SIZE_MAX && q_size < size)
599-
fortify_panic(func, FORTIFY_READ, p_size, size, true);
599+
fortify_panic(func, FORTIFY_READ, q_size, size, true);
600600

601601
/*
602602
* Warn when writing beyond destination field size.

0 commit comments

Comments
 (0)