tools/x86/kcpuid: Check last token too
authorBorislav Petkov <bp@suse.de>
Mon, 15 Mar 2021 12:08:35 +0000 (13:08 +0100)
committerBorislav Petkov <bp@suse.de>
Thu, 18 Mar 2021 10:36:01 +0000 (11:36 +0100)
commite20f67026b5ead2afc5627e98b45e6b65e7fb38c
treecc2daafd2dc8234c51457061defba8da4996212a
parentf706bb59204ba1c47e896b456c97977fc97b7964
tools/x86/kcpuid: Check last token too

Input lines like

  0x8000001E,     0, EAX,   31:0, Extended APIC ID

where the short name is missing lead to a segfault because the loop
takes the long name for the short name and tokens[5] becomes NULL which
explodes later in strcpy().

Check its value too before further processing.

Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Feng Tang <feng.tang@intel.com>
Link: https://lkml.kernel.org/r/20210315125901.30315-1-bp@alien8.de
tools/arch/x86/kcpuid/kcpuid.c