ACK: [PATCH 2/4] acpi: crsdump: fix incorrect use of string size in string copies
Alex Hung
alex.hung at canonical.com
Wed Sep 9 03:21:33 UTC 2015
On 09/08/2015 03:00 PM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
> src/acpi/crsdump/crsdump.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/src/acpi/crsdump/crsdump.c b/src/acpi/crsdump/crsdump.c
> index 37bd17d..4e124c6 100644
> --- a/src/acpi/crsdump/crsdump.c
> +++ b/src/acpi/crsdump/crsdump.c
> @@ -305,12 +305,11 @@ static const char *crs_pin_configuration(const uint64_t val)
> static const char *crs_irq_map(const uint64_t val)
> {
> static char buf[6 + (32 * 4)];
> - const size_t n = sizeof(buf) - 1;
>
> - strncpy(buf, "IRQ:", n);
> + strncpy(buf, "IRQ:", 5);
>
> if (!val) {
> - strncat(buf, " none", n);
> + strncat(buf, " none", 6);
> } else {
> unsigned int i;
>
> @@ -319,7 +318,7 @@ static const char *crs_irq_map(const uint64_t val)
> char tmp[5];
>
> snprintf(tmp, sizeof(tmp), " %u", i);
> - strncat(buf, tmp, n);
> + strncat(buf, tmp, 4);
> }
> }
> }
>
Acked-by: Alex Hung <alex.hung at canonical.com>
More information about the fwts-devel
mailing list