gouuid icon indicating copy to clipboard operation
gouuid copied to clipboard

NewV4() should check number of bytes returned from rand.Read

Open kisielk opened this issue 11 years ago • 3 comments

Conceivably rand.Read could return fewer than the requested number of bytes and still not return an error. This would result in the trailing bytes of the UUID being 0 and no error reported.

kisielk avatar Aug 09 '13 17:08 kisielk

Thanks, I'll look into it.

nu7hatch avatar Oct 03 '13 16:10 nu7hatch

This issue should be handled by Go 1.2, as noted in this bug ticket. It may still be worthwhile to correct here to help out people that may or may not be moving to Go 1.2 in a close time period.

ZackPierce avatar Oct 05 '13 20:10 ZackPierce

Looks like it should be enough to use io.ReadFull

kisielk avatar Oct 05 '13 20:10 kisielk