- Use secure function (strncat)
- Prevent buffer overrun
Change-Id: I47acf1bb39c0be123a486116f811b78f30d6ff01
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
static void execute_crash_modules(int argc, char *argv[], int debug)
{
static void execute_crash_modules(int argc, char *argv[], int debug)
{
char arg_append[PATH_MAX];
char command[PATH_MAX];
char arg_append[PATH_MAX];
char command[PATH_MAX];
- for (i = 1; i < argc; i++) {
- strcat(arg_append, argv[i]);
- strcat(arg_append, " ");
+ for (i = 1; i < argc && length + strlen(argv[i]) + 1 < PATH_MAX; i++) {
+ strncat(arg_append, argv[i], strlen(argv[i]));
+ strncat(arg_append, " ", 1);
+ length += strlen(argv[i]) + 1;
}
/* Execute crash-pipe */
}
/* Execute crash-pipe */