Skip to content
Commit 96eda741 authored by Anisse Astier's avatar Anisse Astier Committed by Will Deacon
Browse files

builtin-run: Fix warning when resolving path



GCC 8.2 gives this warning:

builtin-run.c: In function ‘kvm_run_write_sandbox_cmd.isra.1’:
builtin-run.c:417:28: error: ‘%s’ directive output may be truncated writing up to 4095 bytes into a region of size 4091 [-Werror=format-truncation=]
   snprintf(dst, len, "/host%s", resolved_path);
                            ^~   ~~~~~~~~~~~~~

It's because it understands that len is PATH_MAX, the same as
resolved_path's size. This patch handles the case where the string is
truncated, and fixes the warning.

Reviewed-by: Andre Przywara's avatarAndre Przywara <andre.przywara@arm.com>
Signed-off-by: default avatarAnisse Astier <aastier@freebox.fr>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
parent 2f61a442
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment