Skip to content

Commit 5bedd1d

Browse files
oflebbedeadprogram
authored andcommitted
fix ParseUUID. Return error for invalid UUID strings
1 parent ef90e5d commit 5bedd1d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

uuid.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,12 @@ func ParseUUID(s string) (uuid UUID, err error) {
115115
uuid[3-uuidIndex/8] |= uint32(nibble) << (4 * (7 - uuidIndex%8))
116116
uuidIndex++
117117
}
118-
if uuidIndex != 31 {
118+
if uuidIndex != 32 {
119119
// The UUID doesn't have exactly 32 nibbles. Perhaps a 16-bit or 32-bit
120120
// UUID?
121121
err = errInvalidUUID
122122
}
123-
return uuid, nil
123+
return
124124
}
125125

126126
// String returns a human-readable version of this UUID, such as

0 commit comments

Comments
 (0)