trace: fix build with gcc 10
authorPhil Yang <phil.yang@arm.com>
Tue, 28 Apr 2020 14:37:07 +0000 (22:37 +0800)
committerDavid Marchand <david.marchand@redhat.com>
Wed, 6 May 2020 13:07:18 +0000 (15:07 +0200)
commitb2f8a22e79dc6fbdf40d6f3ec1a24a37438c7840
tree964d67402f930df6d682c7b4617a55cdd94c34d6
parent3df4282917fc5b34a99b5da5d2e35df9f269b7ca
trace: fix build with gcc 10

Prevent from writing beyond the allocated memory.

GCC 10 compiling output:
eal_common_trace_utils.c: In function 'eal_trace_dir_args_save':
eal_common_trace_utils.c:290:24: error: '__builtin___sprintf_chk'   \
may write a terminating nul past the end of the destination \
[-Werror=format-overflow=]
  290 |  sprintf(dir_path, "%s/", optarg);
      |                        ^

Fixes: 8af866df8d8c ("trace: add trace directory configuration parameter")

Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Lijian Zhang <lijian.zhang@arm.com>
Tested-by: Lijian Zhang <lijian.zhang@arm.com>
Acked-by: Sunil Kumar Kori <skori@marvell.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
lib/librte_eal/common/eal_common_trace_utils.c