From d6bb6b601d3f9977ab52c37cf84b1e15cce1a4ab Mon Sep 17 00:00:00 2001 From: Michael Methner Date: Wed, 14 Jun 2023 15:43:47 +0200 Subject: [PATCH] Fix compile error stringop-truncation with GCC 9.4 Signed-off-by: Michael Methner --- src/console/dlt-control-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/console/dlt-control-common.c b/src/console/dlt-control-common.c index 64951c1ab..4b27eac68 100644 --- a/src/console/dlt-control-common.c +++ b/src/console/dlt-control-common.c @@ -124,9 +124,9 @@ void set_ecuid(char *ecuid) if (dlt_parse_config_param("ECUId", &ecuid_conf) == 0) { memset(local_ecuid, 0, DLT_CTRL_ECUID_LEN); strncpy(local_ecuid, ecuid_conf, DLT_CTRL_ECUID_LEN); + local_ecuid[DLT_CTRL_ECUID_LEN -1] = '\0'; if (ecuid_conf !=NULL) free(ecuid_conf); - local_ecuid[DLT_CTRL_ECUID_LEN - 1] = '\0'; } else { pr_error("Cannot read ECUid from dlt.conf\n");