On 27.05.21 13:32, Michael Haener wrote:
> 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) {
> 

Thanks, inserted this into next.

Jan

-- 
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux

-- 
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/3e8a195d-015a-015b-f87c-956884e71df5%40siemens.com.

Reply via email to