diff mbox

jent: use safe format string parameters

Message ID 20150724224127.GA29924@www.outflux.net (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show

Commit Message

Kees Cook July 24, 2015, 10:41 p.m. UTC
Since the API for jent_panic() does not include format string parameters,
adjust the call to panic() to use a literal string to avoid any future
callers from leaking format strings into the panic message.

Signed-off-by: Kees Cook <keescook@chromium.org>
---
 crypto/jitterentropy-kcapi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stephan Mueller July 25, 2015, 10:14 a.m. UTC | #1
Am Freitag, 24. Juli 2015, 15:41:27 schrieb Kees Cook:

Hi Kees,

>Since the API for jent_panic() does not include format string parameters,
>adjust the call to panic() to use a literal string to avoid any future
>callers from leaking format strings into the panic message.
>
>Signed-off-by: Kees Cook <keescook@chromium.org>

Thanks.

Acked-by: Stephan Mueller <smueller@chronox.de>
>---
> crypto/jitterentropy-kcapi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/crypto/jitterentropy-kcapi.c b/crypto/jitterentropy-kcapi.c
>index b32d834144cd..ceea83d13168 100644
>--- a/crypto/jitterentropy-kcapi.c
>+++ b/crypto/jitterentropy-kcapi.c
>@@ -79,7 +79,7 @@ int jent_fips_enabled(void)
>
> void jent_panic(char *s)
> {
>-	panic(s);
>+	panic("%s", s);
> }
>
> void jent_memcpy(void *dest, const void *src, unsigned int n)


Ciao
Stephan
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Herbert Xu July 28, 2015, 7:07 a.m. UTC | #2
On Fri, Jul 24, 2015 at 03:41:27PM -0700, Kees Cook wrote:
> Since the API for jent_panic() does not include format string parameters,
> adjust the call to panic() to use a literal string to avoid any future
> callers from leaking format strings into the panic message.
> 
> Signed-off-by: Kees Cook <keescook@chromium.org>

Applied.
diff mbox

Patch

diff --git a/crypto/jitterentropy-kcapi.c b/crypto/jitterentropy-kcapi.c
index b32d834144cd..ceea83d13168 100644
--- a/crypto/jitterentropy-kcapi.c
+++ b/crypto/jitterentropy-kcapi.c
@@ -79,7 +79,7 @@  int jent_fips_enabled(void)
 
 void jent_panic(char *s)
 {
-	panic(s);
+	panic("%s", s);
 }
 
 void jent_memcpy(void *dest, const void *src, unsigned int n)