tools/hv: Fix fortify format warning
authorBen Hutchings <ben@decadent.org.uk>
Fri, 25 Sep 2015 19:28:10 +0000 (20:28 +0100)
committerAurelien Jarno <aurel32@debian.org>
Fri, 2 Mar 2018 07:52:22 +0000 (07:52 +0000)
commit2535f49a59c845d7f3a1eeee49fe8199867509df
tree01230e3006436bf5089a832ec0a9287ee6f9652d
parentfc7bea9791e9ef3a6608814c78cb515cb15ec3e4
tools/hv: Fix fortify format warning

With fortify enabled, gcc warns:

tools/hv/hv_kvp_daemon.c:705:2: error: format not a string literal and no format arguments [-Werror=format-security]
  snprintf(dev_id, sizeof(dev_id), kvp_net_dir);
  ^

kvp_net_dir is a pointer to a string literal, but lacks const
qualification.  As it is never modified, it should be a const
array rather than a pointer.

Also, while snprintf() has a bounds check, the following strcat()s
do not.  Combine them into a single snprintf().

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Topic bugfix/x86
Gbp-Pq: Name tools-hv-fix-fortify-format-warning.patch
tools/hv/hv_kvp_daemon.c