Skip to content

Commit

Permalink
fix buffer length
Browse files Browse the repository at this point in the history
no need to use it twice
  • Loading branch information
sni committed May 8, 2024
1 parent 316a527 commit 28dfb19
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/snclient/check_drivesize_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ func (l *CheckDrivesize) setVolumes(requiredDisks map[string]map[string]string)
volumes := []string{}
bufLen := windows.MAX_PATH + 1
volumeName := make([]uint16, bufLen)
hndl, err := windows.FindFirstVolume(&volumeName[0], uint32(bufLen*2))
hndl, err := windows.FindFirstVolume(&volumeName[0], uint32(bufLen))
if err != nil {
log.Tracef("FindFirstVolume: %s", err.Error())

Expand All @@ -335,7 +335,7 @@ func (l *CheckDrivesize) setVolumes(requiredDisks map[string]map[string]string)
volumes = append(volumes, syscall.UTF16ToString(volumeName))

for {
err := windows.FindNextVolume(hndl, &volumeName[0], uint32(bufLen*2))
err := windows.FindNextVolume(hndl, &volumeName[0], uint32(bufLen))
if err != nil {
log.Tracef("FindNextVolume: %s", err.Error())

Expand Down

0 comments on commit 28dfb19

Please sign in to comment.