On Thu, Oct 19, 2017 at 03:56:02PM +0200, Andreas J. Reichel wrote:
Can we please apply this patch now? [ This is 1/3 ]

> From: Andreas Reichel <[email protected]>
> 
> Buffer size must include 0-termination for strings.
> 
> Signed-off-by: Andreas Reichel <[email protected]>
> ---
>  env/env_api_fat.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/env/env_api_fat.c b/env/env_api_fat.c
> index 354d7f8..0635024 100644
> --- a/env/env_api_fat.c
> +++ b/env/env_api_fat.c
> @@ -475,7 +475,7 @@ int bgenv_get(BGENV *env, char *key, char *type, void 
> *data, uint32_t maxlen)
>       case EBGENV_KERNELFILE:
>               str16to8(buffer, env->data->kernelfile);
>               if (!data) {
> -                     return strlen(buffer);
> +                     return strlen(buffer)+1;
>               }
>               strncpy(data, buffer, strlen(buffer)+1);
>               if (type) {
> @@ -485,7 +485,7 @@ int bgenv_get(BGENV *env, char *key, char *type, void 
> *data, uint32_t maxlen)
>       case EBGENV_KERNELPARAMS:
>               str16to8(buffer, env->data->kernelparams);
>               if (!data) {
> -                     return strlen(buffer);
> +                     return strlen(buffer)+1;
>               }
>               strncpy(data, buffer, strlen(buffer)+1);
>               if (type) {
> @@ -495,7 +495,7 @@ int bgenv_get(BGENV *env, char *key, char *type, void 
> *data, uint32_t maxlen)
>       case EBGENV_WATCHDOG_TIMEOUT_SEC:
>               sprintf(buffer, "%u", env->data->watchdog_timeout_sec);
>               if (!data) {
> -                     return strlen(buffer);
> +                     return strlen(buffer)+1;
>               }
>               strncpy(data, buffer, strlen(buffer)+1);
>               if (type) {
> @@ -505,7 +505,7 @@ int bgenv_get(BGENV *env, char *key, char *type, void 
> *data, uint32_t maxlen)
>       case EBGENV_REVISION:
>               sprintf(buffer, "%u", env->data->revision);
>               if (!data) {
> -                     return strlen(buffer);
> +                     return strlen(buffer)+1;
>               }
>               strncpy(data, buffer, strlen(buffer)+1);
>               if (type) {
> @@ -515,7 +515,7 @@ int bgenv_get(BGENV *env, char *key, char *type, void 
> *data, uint32_t maxlen)
>       case EBGENV_USTATE:
>               sprintf(buffer, "%u", env->data->ustate);
>               if (!data) {
> -                     return strlen(buffer);
> +                     return strlen(buffer)+1;
>               }
>               strncpy(data, buffer, strlen(buffer)+1);
>               if (type) {
> -- 
> 2.14.2
> 

-- 
Andreas Reichel
Dipl.-Phys. (Univ.)
Software Consultant

[email protected], +49-174-3180074
TNG Technology Consulting GmbH, Betastr. 13a, 85774 Unterfoehring
Geschaeftsfuehrer: Henrik Klagges, Dr. Robert Dahlke, Gerhard Mueller
Sitz: Unterfoehring * Amtsgericht Muenchen * HRB 135082

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/efibootguard-dev/20171102115302.GA5374%40iiotirae.
For more options, visit https://groups.google.com/d/optout.

Reply via email to