efi/libstub: Handle unterminated cmdline
authorArvind Sankar <nivedita@alum.mit.edu>
Thu, 13 Aug 2020 18:58:11 +0000 (14:58 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Aug 2020 09:49:19 +0000 (11:49 +0200)
commit1f802ace4bd5a2762a2e8637f2ea1e3aa31fb0d5
tree99211da5999aec5ff4ce18972af8022dfa86a666
parentca60a5eb83720d0eb425e6192723afa77ac86a73
efi/libstub: Handle unterminated cmdline

commit 8a8a3237a78cbc0557f0eb16a89f16d616323e99 upstream.

Make the command line parsing more robust, by handling the case it is
not NUL-terminated.

Use strnlen instead of strlen, and make sure that the temporary copy is
NUL-terminated before parsing.

Cc: <stable@vger.kernel.org>
Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
Link: https://lore.kernel.org/r/20200813185811.554051-4-nivedita@alum.mit.edu
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/firmware/efi/libstub/efi-stub-helper.c