diff options
author | Andre Przywara <andre.przywara@arm.com> | 2019-02-04 16:34:56 +0000 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2019-02-08 16:21:57 +0000 |
commit | 266a0ed4c6a50dd80e7586ea020c5e963f4dd37b (patch) | |
tree | aab30bd2b0f647987dd78f3940d68884c41844e9 | |
parent | 5eb1f27ac0f48ad012884b86d577ca27608bfdc5 (diff) | |
download | kvmtool-266a0ed4c6a50dd80e7586ea020c5e963f4dd37b.tar.gz |
builtin-run: Replace strncpy calls with strlcpy
There are two uses of strncpy in builtin-run.c, where we don't make
proper use of strncpy, so that GCC 8.x complains and aborts compilation.
Replace those two calls with strlcpy(), which does the right thing in
our case.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
-rw-r--r-- | builtin-run.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin-run.c b/builtin-run.c index 463a481f..f8dc6c72 100644 --- a/builtin-run.c +++ b/builtin-run.c @@ -300,7 +300,7 @@ static const char *find_kernel(void) k++; continue; } - strncpy(kernel, *k, PATH_MAX); + strlcpy(kernel, *k, PATH_MAX); return kernel; } @@ -418,7 +418,7 @@ static void resolve_program(const char *src, char *dst, size_t len) die("Pathname too long: %s -> %s\n", src, resolved_path); } else - strncpy(dst, src, len); + strlcpy(dst, src, len); } static void kvm_run_write_sandbox_cmd(struct kvm *kvm, const char **argv, int argc) |