summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorPatrick Georgi <patrick@georgi-clan.de>2013-11-11 15:20:56 +0100
committerPatrick Georgi <patrick@georgi-clan.de>2014-01-21 19:07:17 +0100
commit2a1d5b061db4e0019fa4a7f0a8c0fdca2c5c2242 (patch)
treec01943ee1037075fe9b2b2dddb2e9250f9867618 /util
parentdf29f1ba6f4f81dbae704f1ab97c9f3044d3b930 (diff)
cbfstool: cleaner filling fields
The LARCHIVE header isn't a string (not null terminated). It confused coverity, and while it should be obvious that we're not aiming for any null bytes after the header, we can also just not pretend it's a string. Change-Id: Ibd5333a27d8920b8a97de554f1cd27e28f4f7d0a Found-by: Coverity Scan Signed-off-by: Patrick Georgi <patrick@georgi-clan.de> Reviewed-on: http://review.coreboot.org/4088 Reviewed-by: Ronald G. Minnich <rminnich@gmail.com> Tested-by: build bot (Jenkins)
Diffstat (limited to 'util')
-rw-r--r--util/cbfstool/common.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/util/cbfstool/common.c b/util/cbfstool/common.c
index aa986963c1..03345df1eb 100644
--- a/util/cbfstool/common.c
+++ b/util/cbfstool/common.c
@@ -283,7 +283,7 @@ int cbfs_file_header(unsigned long physaddr)
struct cbfs_file *cbfs_create_empty_file(uint32_t physaddr, uint32_t size)
{
struct cbfs_file *nextfile = (struct cbfs_file *)phys_to_virt(physaddr);
- strncpy((char *)(nextfile->magic), "LARCHIVE", 8);
+ memcpy((char *)(nextfile->magic), "LARCHIVE", 8);
nextfile->len = htonl(size);
nextfile->type = htonl(0xffffffff);
nextfile->checksum = 0; // FIXME?
@@ -652,7 +652,7 @@ void *create_cbfs_file(const char *filename, void *data, uint32_t * datasize,
}
memset(newdata, 0xff, *datasize + headersize);
struct cbfs_file *nextfile = (struct cbfs_file *)newdata;
- strncpy((char *)(nextfile->magic), "LARCHIVE", 8);
+ memcpy((char *)(nextfile->magic), "LARCHIVE", 8);
nextfile->len = htonl(*datasize);
nextfile->type = htonl(type);
nextfile->checksum = 0; // FIXME?