Skip to content

Commit

Permalink
Fix gosec warnings on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
maruel committed Aug 9, 2024
1 parent d2808e1 commit 9283998
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions d2xx_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ func (h handle) ResetDevice() Err {
func (h handle) GetDeviceInfo() (uint32, uint16, uint16, Err) {
var d uint32
var id uint32
/* #nosec G103 */
if r1, _, _ := pGetDeviceInfo.Call(h.toH(), uintptr(unsafe.Pointer(&d)), uintptr(unsafe.Pointer(&id)), 0, 0, 0); r1 != 0 {
if r1, _, _ := pGetDeviceInfo.Call(h.toH(), uintptr(unsafe.Pointer(&d)), uintptr(unsafe.Pointer(&id)), 0, 0, 0); r1 != 0 /* #nosec G103 */ {
return unknown, 0, 0, Err(r1)
}
return d, uint16(id >> 16), uint16(id), 0
Expand Down Expand Up @@ -135,17 +134,15 @@ func (h handle) WriteEE(offset uint8, value uint16) Err {

func (h handle) EEUASize() (int, Err) {
var size uint32
/* #nosec G103 */
if r1, _, _ := pEEUASize.Call(h.toH(), uintptr(unsafe.Pointer(&size))); r1 != 0 {
if r1, _, _ := pEEUASize.Call(h.toH(), uintptr(unsafe.Pointer(&size))); r1 != 0 /* #nosec G103 */ {
return 0, Err(r1)
}
return int(size), 0
}

func (h handle) EEUARead(ua []byte) Err {
var size uint32
/* #nosec G103 */
if r1, _, _ := pEEUARead.Call(h.toH(), uintptr(unsafe.Pointer(&ua[0])), uintptr(len(ua)), uintptr(unsafe.Pointer(&size))); r1 != 0 {
if r1, _, _ := pEEUARead.Call(h.toH(), uintptr(unsafe.Pointer(&ua[0])), uintptr(len(ua)), uintptr(unsafe.Pointer(&size))); r1 != 0 /* #nosec G103 */ {
return Err(r1)
}
if int(size) != len(ua) {
Expand Down

0 comments on commit 9283998

Please sign in to comment.