Applied, thanks!

Flavio Cruz, le dim. 09 févr. 2025 22:37:56 -0500, a ecrit:
> ---
>  mach/mig_strncpy.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/mach/mig_strncpy.c b/mach/mig_strncpy.c
> index b0c001d775..dbd0a08e56 100644
> --- a/mach/mig_strncpy.c
> +++ b/mach/mig_strncpy.c
> @@ -6,6 +6,14 @@
>  vm_size_t
>  __mig_strncpy (char *dst, const char *src, vm_size_t len)
>  {
> -  return __stpncpy (dst, src, len) - dst;
> +  if (len == 0)
> +    return 0;
> +
> +  char *end = __stpncpy (dst, src, len - 1);
> +  vm_size_t ret = end - dst;
> +  /* Null terminate the string.  */
> +  if (ret == len - 1)
> +    *end = '\0';
> +  return ret;
>  }
>  weak_alias (__mig_strncpy, mig_strncpy)
> -- 
> 2.47.2
> 
> 

-- 
Samuel
<i> ben oui ce serait idiot, mais osb
  -+- m'en fous de faire un truc débile ! -+-

Reply via email to