Skip to content
Commit 5eff88dd authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by Ard Biesheuvel
Browse files

efi: cper: fix scnprintf() use in cper_mem_err_location()



The last two if-clauses fail to update n, so whatever they might have
written at &msg[n] would be cut off by the final nul-termination.

That nul-termination is redundant; scnprintf(), just like snprintf(),
guarantees a nul-terminated output buffer, provided the buffer size is
positive.

And there's no need to discount one byte from the initial buffer;
vsnprintf() expects to be given the full buffer size - it's not going
to write the nul-terminator one beyond the given (buffer, size) pair.

Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
parent e73f0f0e
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment