qualcomm: qclib: Ensure interface table entry name is terminated

This string is printed in dump_te_table() so we should make sure it's
properly null-terminated.

This fixes Coverity issue 1401305.

Change-Id: I45827f552c2d8a4e01b50a699ac88ee457043282
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/33375
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Julius Werner 2019-06-10 13:18:59 -07:00 committed by Patrick Georgi
parent 5399f80848
commit 096fd0a64b
1 changed files with 1 additions and 1 deletions

View File

@ -41,7 +41,7 @@ void qclib_add_if_table_entry(const char *name, void *base,
struct qclib_cb_if_table_entry *te = struct qclib_cb_if_table_entry *te =
&qclib_cb_if_table.te[qclib_cb_if_table.num_entries++]; &qclib_cb_if_table.te[qclib_cb_if_table.num_entries++];
assert(qclib_cb_if_table.num_entries <= qclib_cb_if_table.max_entries); assert(qclib_cb_if_table.num_entries <= qclib_cb_if_table.max_entries);
strncpy(te->name, name, sizeof(te->name)); strncpy(te->name, name, sizeof(te->name) - 1);
te->blob_address = (uintptr_t)base; te->blob_address = (uintptr_t)base;
te->size = size; te->size = size;
te->blob_attributes = attrs; te->blob_attributes = attrs;