From a18196cdc28d4324923a280e3b724d7a8950a7a4 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Wed, 1 May 2019 12:02:33 +0100 Subject: [PATCH] Making sure that string gets NULL terminated in benchmark_radio.cc when using strncpy. Fixes compiler warning in GCC 8.2 --- lib/src/radio/test/benchmark_radio.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/src/radio/test/benchmark_radio.cc b/lib/src/radio/test/benchmark_radio.cc index f438f7c33..3f0e534d6 100644 --- a/lib/src/radio/test/benchmark_radio.cc +++ b/lib/src/radio/test/benchmark_radio.cc @@ -95,13 +95,16 @@ void parse_args(int argc, char **argv) { file_pattern = argv[optind]; break; case 'a': - strncpy(radios_args[0], argv[optind], 64); + strncpy(radios_args[0], argv[optind], 63); + radios_args[0][63] = '\0'; break; case 'b': - strncpy(radios_args[1], argv[optind], 64); + strncpy(radios_args[1], argv[optind], 63); + radios_args[1][63] = '\0'; break; case 'c': - strncpy(radios_args[2], argv[optind], 64); + strncpy(radios_args[2], argv[optind], 63); + radios_args[2][63] = '\0'; break; case 'r': nof_radios = (uint32_t)atoi(argv[optind]);