[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#20998: Out of bounds global read in shred / genpattern()
From: |
Pádraig Brady |
Subject: |
bug#20998: Out of bounds global read in shred / genpattern() |
Date: |
Tue, 07 Jul 2015 03:28:32 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 |
On 07/07/15 01:45, Pádraig Brady wrote:
> On 07/07/15 00:29, Hanno Böck wrote:
>> Hi,
>>
>> There is an out of bounds read error in the function genpattern() in
>> shred (coreutils 8.23). This issue only appears randomly.
>>
>> To test:
>> a) recompile coreutils 8.23 with address sanitizer
> Nice one!
>
> It looks like the restriction to the k patterns available
> was lost with v5.92-1462-g65533e1 and that this should
> fix it up.
>
> diff --git a/src/shred.c b/src/shred.c
> index 63bcd6f..74f7ad9 100644
> --- a/src/shred.c
> +++ b/src/shred.c
> @@ -785,6 +785,7 @@ genpattern (int *dest, size_t num, struct randint_source
> *s)
> n--;
> }
> p++;
> + k--;
> }
> while (n);
> break;
Attached is the full patch including a test.
Marking this as done.
thanks!
Pádraig.
shred-patterns.patch
Description: Text Data