Avoid the "stringop-overflow" error. The so far specified bound depends on the length of the source argument.
Signed-off-by: Michael Haener <[email protected]> --- env/env_config_partitions.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/env/env_config_partitions.c b/env/env_config_partitions.c index f4b17e2..db3e08f 100644 --- a/env/env_config_partitions.c +++ b/env/env_config_partitions.c @@ -53,16 +53,11 @@ bool probe_config_partitions(CONFIG_PART *cfgpart) (void)snprintf(devpath, 4096, "%s%u", dev->path, part->num); } + cfgpart[count].devpath = strdup(devpath); if (!cfgpart[count].devpath) { - cfgpart[count].devpath = - malloc(strlen(devpath) + 1); - if (!cfgpart[count].devpath) { - VERBOSE(stderr, "Out of memory."); - return false; - } + VERBOSE(stderr, "Out of memory."); + return false; } - strncpy(cfgpart[count].devpath, devpath, - strlen(devpath) + 1); if (probe_config_file(&cfgpart[count])) { printf_debug("%s", "Environment file found.\n"); if (count >= ENV_NUM_CONFIG_PARTS) { -- 2.26.3 -- You received this message because you are subscribed to the Google Groups "EFI Boot Guard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/efibootguard-dev/20210527113258.284428-1-michael.haener%40siemens.com.
