Skip to content

Commit

Permalink
fix verify bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mojocn authored Dec 8, 2023
1 parent 88f0921 commit 5ab86bd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions store_memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ func (s *memoryStore) Set(id string, value string) error {
}

func (s *memoryStore) Verify(id, answer string, clear bool) bool {
if id == "" || answer == "" {
return false
}
v := s.Get(id, clear)
return v != "" && v == answer
}
Expand Down
4 changes: 4 additions & 0 deletions store_memory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ func Test_memoryStore_Verify(t *testing.T) {
if got {
t.Error("failed3")
}
got = DefaultMemStore.Verify("saaf", "", true)
if got {
t.Error("CVE-2023-45292 GO-2023-2386")
}
}

func Test_memoryStore_Get(t *testing.T) {
Expand Down

0 comments on commit 5ab86bd

Please sign in to comment.