diff options
author | Eric Biggers <ebiggers@google.com> | 2019-06-28 14:34:41 -0700 |
---|---|---|
committer | Eric Biggers <ebiggers@google.com> | 2019-06-28 14:34:41 -0700 |
commit | 88438bb2558d2b86c853ae388d2aa12a4bc0a81e (patch) | |
tree | 43c3945bd2dad203ad017839b3ca98bae7ff6cd9 | |
parent | ac3717192cfaa496ae8ffbe1f6b2a02ce88e629c (diff) | |
download | fsverity-utils-88438bb2558d2b86c853ae388d2aa12a4bc0a81e.tar.gz |
cmd_sign: avoid passing NULL to memcpy()
Technically, memcpy(foo, NULL, 0) has undefined behavior...
Signed-off-by: Eric Biggers <ebiggers@google.com>
-rw-r--r-- | cmd_sign.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -407,7 +407,8 @@ static bool compute_root_hash(struct filedes *file, u64 file_size, u64 offset; bool ok = false; - memcpy(padded_salt, salt, salt_size); + if (salt_size != 0) + memcpy(padded_salt, salt, salt_size); /* Compute number of levels */ for (blocks = DIV_ROUND_UP(file_size, block_size); blocks > 1; |