[Toybox] grep doesn't allocate enough space

Rob Landley rob at landley.net
Sat Nov 9 17:37:50 PST 2013


On 10/21/2013 04:10:32 PM, William Haddon wrote:
> Grep miscalculates the amount of memory it needs to allocate when  
> "converting strings to one big regex" when the -e flag is not  
> specified. Since in this case "\|" is inserted between strings rather  
> than "|", two extra bytes rather than one need to be provided for  
> each string. I noticed this because it caused grep to seg-fault on  
> musl when a regex of exactly seven characters is provided. I've  
> included the patch to fix it below.
> 
> William Haddon

Applied.

Thanks,

Rob


More information about the Toybox mailing list