Message ID | 20210619172150.1294172-3-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
Series | Fix build issues on s390x and ppc64el | expand |
On 2021-06-19 11:21 a.m., Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > Don't use strncpy, use memcpy of the raw 4 char table name. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/lib/src/fwts_acpi_tables.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c > index 42285f99..b8b710bc 100644 > --- a/src/lib/src/fwts_acpi_tables.c > +++ b/src/lib/src/fwts_acpi_tables.c > @@ -261,7 +261,7 @@ static void fwts_acpi_add_table( > if (strncmp(tables[i].name, name, 4) == 0) > which++; > if (tables[i].data == NULL) { > - strncpy(tables[i].name, name, 4); > + memcpy(tables[i].name, name, 4); > tables[i].name[4] = 0; > tables[i].data = table; > tables[i].addr = addr; > Acked-by: Alex Hung <alex.hung@canonical.com>
On 6/20/21 1:21 AM, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > Don't use strncpy, use memcpy of the raw 4 char table name. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/lib/src/fwts_acpi_tables.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c > index 42285f99..b8b710bc 100644 > --- a/src/lib/src/fwts_acpi_tables.c > +++ b/src/lib/src/fwts_acpi_tables.c > @@ -261,7 +261,7 @@ static void fwts_acpi_add_table( > if (strncmp(tables[i].name, name, 4) == 0) > which++; > if (tables[i].data == NULL) { > - strncpy(tables[i].name, name, 4); > + memcpy(tables[i].name, name, 4); > tables[i].name[4] = 0; > tables[i].data = table; > tables[i].addr = addr; > Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c index 42285f99..b8b710bc 100644 --- a/src/lib/src/fwts_acpi_tables.c +++ b/src/lib/src/fwts_acpi_tables.c @@ -261,7 +261,7 @@ static void fwts_acpi_add_table( if (strncmp(tables[i].name, name, 4) == 0) which++; if (tables[i].data == NULL) { - strncpy(tables[i].name, name, 4); + memcpy(tables[i].name, name, 4); tables[i].name[4] = 0; tables[i].data = table; tables[i].addr = addr;