mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-22 05:30:24 +00:00
dm: passthrough: check romfile path length in command
This patch checks the romfile path length in command line to avoid possible buffer overflow, maximum path supported is 255 characters. Tracked-On: #8439 Signed-off-by: Jiaqing Zhao <jiaqing.zhao@linux.intel.com> Reviewed-by: Jian Jun Chen <jian.jun.chen@intel.com>
This commit is contained in:
parent
b35b8ef677
commit
d5720079d5
@ -744,7 +744,11 @@ passthru_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
|
|||||||
} else if (!strncmp(opt, "romfile=", 8)) {
|
} else if (!strncmp(opt, "romfile=", 8)) {
|
||||||
need_rombar = true;
|
need_rombar = true;
|
||||||
opt += 8;
|
opt += 8;
|
||||||
strcpy(rom_file, opt);
|
if (strnlen(opt, PATH_MAX) >= sizeof(rom_file)) {
|
||||||
|
pr_err("romfile path too long, max supported path length is 255");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
strncpy(rom_file, opt, sizeof(rom_file));
|
||||||
} else
|
} else
|
||||||
pr_warn("Invalid passthru options:%s", opt);
|
pr_warn("Invalid passthru options:%s", opt);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user