Merge pull request #488 from maxarchx/master

Apply UUID string length check before parsing
pull/491/head
Jack Christensen 2018-12-01 10:39:47 -06:00 committed by GitHub
commit b5fee42f0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -87,6 +87,9 @@ func (src *UUID) AssignTo(dst interface{}) error {
// parseUUID converts a string UUID in standard form to a byte array.
func parseUUID(src string) (dst [16]byte, err error) {
if len(src) < 36 {
return dst, errors.Errorf("cannot parse UUID %v", src)
}
src = src[0:8] + src[9:13] + src[14:18] + src[19:23] + src[24:]
buf, err := hex.DecodeString(src)
if err != nil {