]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
platform/x86: huawei-wmi: Fix a precision vs width printf bug
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 14 Oct 2019 10:58:01 +0000 (13:58 +0300)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 15 Oct 2019 07:55:11 +0000 (10:55 +0300)
This was supposed to be precision "%.*s" instead of width "%*s".  It's
possible that this results in printing beyond the end of the string.

Fixes: a970b95345ab ("platform/x86: huawei-wmi: Add debugfs support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
drivers/platform/x86/huawei-wmi.c

index 5bb6fbc9502b267c3de93438beaebfc8873db842..5837d1b8693d153813be648eadbd54140deca227 100644 (file)
@@ -616,7 +616,7 @@ static void huawei_wmi_debugfs_call_dump(struct seq_file *m, void *data,
                seq_printf(m, "0x%llx", obj->integer.value);
                break;
        case ACPI_TYPE_STRING:
-               seq_printf(m, "\"%*s\"", obj->string.length, obj->string.pointer);
+               seq_printf(m, "\"%.*s\"", obj->string.length, obj->string.pointer);
                break;
        case ACPI_TYPE_BUFFER:
                seq_puts(m, "{");