include/linux/fortify-string.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
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: 3d965b33e40d ("fortify: Improve buffer overflow reporting")
Signed-off-by: Kees Cook <kees@kernel.org>
---
Cc: <linux-hardening@vger.kernel.org>
---
include/linux/fortify-string.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/fortify-string.h b/include/linux/fortify-string.h
index e4ce1cae03bf..b3b53f8c1b28 100644
--- a/include/linux/fortify-string.h
+++ b/include/linux/fortify-string.h
@@ -596,7 +596,7 @@ __FORTIFY_INLINE bool fortify_memcpy_chk(__kernel_size_t size,
if (p_size != SIZE_MAX && p_size < size)
fortify_panic(func, FORTIFY_WRITE, p_size, size, true);
else if (q_size != SIZE_MAX && q_size < size)
- fortify_panic(func, FORTIFY_READ, p_size, size, true);
+ fortify_panic(func, FORTIFY_READ, q_size, size, true);
/*
* Warn when writing beyond destination field size.
--
2.34.1
On 29/07/25 17:18, Kees Cook wrote: > 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: 3d965b33e40d ("fortify: Improve buffer overflow reporting") > Signed-off-by: Kees Cook <kees@kernel.org> Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org> Thanks! -Gustavo > --- > Cc: <linux-hardening@vger.kernel.org> > --- > include/linux/fortify-string.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/linux/fortify-string.h b/include/linux/fortify-string.h > index e4ce1cae03bf..b3b53f8c1b28 100644 > --- a/include/linux/fortify-string.h > +++ b/include/linux/fortify-string.h > @@ -596,7 +596,7 @@ __FORTIFY_INLINE bool fortify_memcpy_chk(__kernel_size_t size, > if (p_size != SIZE_MAX && p_size < size) > fortify_panic(func, FORTIFY_WRITE, p_size, size, true); > else if (q_size != SIZE_MAX && q_size < size) > - fortify_panic(func, FORTIFY_READ, p_size, size, true); > + fortify_panic(func, FORTIFY_READ, q_size, size, true); > > /* > * Warn when writing beyond destination field size.
© 2016 - 2025 Red Hat, Inc.