diff options
author | Hannah Williams <hannah.williams@intel.com> | 2017-08-02 18:13:33 -0700 |
---|---|---|
committer | Martin Roth <martinroth@google.com> | 2017-08-10 15:58:23 +0000 |
commit | 58810c7af5f80ef0c58a7aa77a4c20cfcc7d5474 (patch) | |
tree | 5c27ad51ff1cf0d68b99fe1aa315410678ffebac /src/soc | |
parent | d0df1d7c4ebd4d8e654c8350c27a0d9f749a88f6 (diff) | |
download | coreboot-58810c7af5f80ef0c58a7aa77a4c20cfcc7d5474.tar.xz |
soc/intel/apollolake: Add file path check
Fixes Coverity Issue: 1372243
Change-Id: Ib7e43b195357c723e1ae51f609a8b07ad984380a
Signed-off-by: Hannah Williams <hannah.williams@intel.com>
Reviewed-on: https://review.coreboot.org/20867
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/soc')
-rw-r--r-- | src/soc/intel/apollolake/cse.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/soc/intel/apollolake/cse.c b/src/soc/intel/apollolake/cse.c index 515d32b99c..3e1792c84a 100644 --- a/src/soc/intel/apollolake/cse.c +++ b/src/soc/intel/apollolake/cse.c @@ -92,6 +92,10 @@ static int read_cse_file(const char *path, void *buff, size_t *size, return 0; } + if (strnlen(path, sizeof(msg.file_name)) >= sizeof(msg.file_name)) { + printk(BIOS_ERR, "path too big for msg.file_name buffer\n"); + return 0; + } strncpy(msg.file_name, path, sizeof(msg.file_name)); msg.mkhi_hdr.fields.group_id = MKHI_GROUP_ID_MCA; msg.mkhi_hdr.fields.command = READ_FILE; |