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.