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

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Thu Aug 13 13:48:04 GMT 2026



On 13/08/26 09:40, Andreas Schwab wrote:
> 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
> 

Ack, ok with this fix?



More information about the Libc-alpha mailing list