[PATCH] lib: fwts_args: use strncpy instead of strcpy
Colin King
colin.king at canonical.com
Thu May 14 11:33:26 UTC 2015
From: Colin Ian King <colin.king at canonical.com>
Coverity Scan was flagging up the use of strcpy and of a potential
buffer overrun, so use strncpy instead.
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
src/lib/src/fwts_args.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/lib/src/fwts_args.c b/src/lib/src/fwts_args.c
index 86e0d4b..5dc9261 100644
--- a/src/lib/src/fwts_args.c
+++ b/src/lib/src/fwts_args.c
@@ -299,8 +299,8 @@ void fwts_args_show_options(void)
}
}
}
- strcat(ptr, "--");
- strcat(ptr, option->long_name);
+ strncat(ptr, "--", ptr - buffer - 1);
+ strncat(ptr, option->long_name, ptr - buffer - 3);
fwts_args_show_option(width, buffer, option->explanation);
}
--
2.1.4
More information about the fwts-devel
mailing list