Skip to content

Commit

Permalink
set: limit windows service size
Browse files Browse the repository at this point in the history
Signed-off-by: Filip Weiss <[email protected]>
  • Loading branch information
fiws committed Oct 16, 2022
1 parent 5205e6f commit 8976d18
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions keyring_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,14 @@ func (k windowsKeychain) Set(service, username, password string) error {
return ErrSetDataTooBig
}

// service may not exceed 32k
if len(service) > 1024*32 {
// service may not exceed 512 bytes (might need more testing)
if len(service) >= 512 {
return ErrSetDataTooBig
}

// service may not exceed 32k but problems occur before that
// so we limit it to 30k
if len(service) > 1024*30 {
return ErrSetDataTooBig
}

Expand Down

0 comments on commit 8976d18

Please sign in to comment.