[PATCH] posix: Remove unnecessary overflow check in wordexp (BZ 34090)

Andreas Schwab schwab@suse.de
Thu Aug 13 12:40:39 GMT 2026


On Aug 13 2026, Adhemerval Zanella wrote:

> @@ -2269,16 +2268,14 @@ wordexp (const char *words, wordexp_t *pwordexp, int flags)
>      {
>        /* WRDE_APPEND with an existing word list: duplicate the array so that
>  	 realloc during parsing does not invalidate the caller's pointer.  The
> -	 strings themselves are shared.  */
> -      size_t num_p;
> -      char **dup;
> -      if (INT_ADD_WRAPV (pwordexp->we_offs, pwordexp->we_wordc, &num_p)
> -	  || INT_ADD_WRAPV (num_p, 1, &num_p))
> -	return WRDE_NOSPACE;
> -      dup = __libc_reallocarray (NULL, num_p, sizeof *dup);
> +	 strings themselves are shared an the array already holds

                                       and

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


More information about the Libc-alpha mailing list