KEYS: check the certfile for ASN1 encoding before inserting
PATCH 1/1 KEYS: check the certfile for ASN1 encoding before inserting
The certfile to be inserted into the kernel must be in ASN1 encoding. This patch implements a guard against invalid certfile.
Signed-off-by Clay Chang <[email protected]>
--- scripts/insert-sys-cert.c | 5 +++++ 1 file changed, 5 insertions(+)
scripts/insert-sys-cert.c +5 -0
@@ -311,6 +311,11 @@ int main(int argc, char **argv)if (!cert)exit (EXIT_FAILURE ); +if (cert[0 ] !=0x30 && cert[1 ] !=0x82 ) { +err ("Invalid certfile.\n" ); +exit (EXIT_FAILURE ); + } + hdr =map_file (vmlinux_file, &vmlinux_size);if (!hdr)exit (EXIT_FAILURE );
Signature · 1 line
2.16.6