]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
acpi: Fix buffer overflow in do_acpi_dump()
authorAndrew Scull <ascull@google.com>
Sun, 3 Apr 2022 10:39:09 +0000 (10:39 +0000)
committerTom Rini <trini@konsulko.com>
Fri, 29 Apr 2022 15:11:36 +0000 (11:11 -0400)
When do_acpi_dump() converts the table name to upper case, pass the
actual size of the output buffer so that the null terminator doesn't get
written beyond the end of the buffer.

Signed-off-by: Andrew Scull <ascull@google.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
cmd/acpi.c

index c543f1e3c290f9dfa9db1434dce1ebea6f314ece..0e473b415dd0832022794011465878c44bcc5419 100644 (file)
@@ -178,7 +178,7 @@ static int do_acpi_dump(struct cmd_tbl *cmdtp, int flag, int argc,
                printf("Table name '%s' must be four characters\n", name);
                return CMD_RET_FAILURE;
        }
-       str_to_upper(name, sig, -1);
+       str_to_upper(name, sig, ACPI_NAME_LEN);
        ret = dump_table_name(sig);
        if (ret) {
                printf("Table '%.*s' not found\n", ACPI_NAME_LEN, sig);