diff --git a/utils/fwparam_ibft/fwparam_ppc.c b/utils/fwparam_ibft/fwparam_ppc.c index b040837..6d344d1 100644 --- a/utils/fwparam_ibft/fwparam_ppc.c +++ b/utils/fwparam_ibft/fwparam_ppc.c @@ -436,10 +436,14 @@ int fwparam_ppc(struct boot_context *context, const char *filepath) * the appropriate FCODE with a load method. */ if (filepath) { - strncat(filename, filepath, FILENAMESZ); + strncat(filename, filepath, FILENAMESZ - 1); + filename[FILENAMESZ - 1] = '\0'; fplen = strlen(filename); - } else - strncat(filename, DT_TOP, FILENAMESZ); + } else { + strncat(filename, DT_TOP, FILENAMESZ - 1); + filename[FILENAMESZ - 1] = '\0'; + fplen = strlen(filename); + } strncat(filename + fplen, BOOTPATH, FILENAMESZ - fplen);