raphaelts3 / wyd2encdec

Function call made to an unsafe package GSC-G103
Security
Minor
2 years ago3 years old
Use of unsafe calls should be audited
102	count, err := f.Read(dataRaw)
103	i := 0
104	for i < count {
105		packet := (*MsgHeader)(unsafe.Pointer(&dataRaw[i]))106		*packets = append(*packets, packet)
107		i += int(packet.size)
108	}
Use of unsafe calls should be audited
 56        key := int(uint8(keys[uint16(packet.key) << 1]))
 57        for ; j < packet.size; j++ {
 58			mappedKey := uint32(keys[(uint16(key % 256) << 1) + 1])
 59			currPtr := unsafe.Pointer(uintptr(ptr) + uintptr(j)) 60            switch j & 3 {
 61				case 0:
 62					*(*uint8)(currPtr) = uint8(uint32(*(*uint8)(currPtr)) - uint32(mappedKey << 1))
Use of unsafe calls should be audited
 51
 52func decrypt() {
 53    for _, packet := range encryptedPackets {
 54		ptr := unsafe.Pointer(packet) 55        j := uint16(4)
 56        key := int(uint8(keys[uint16(packet.key) << 1]))
 57        for ; j < packet.size; j++ {
Use of unsafe calls should be audited
 33        key := int(uint8(keys[uint16(packet.key) << 1]))
 34        for ; j < packet.size; j++ {
 35			mappedKey := uint32(keys[(uint16(key % 256) << 1) + 1])
 36			currPtr := unsafe.Pointer(uintptr(ptr) + uintptr(j)) 37            switch j & 3 {
 38				case 0:
 39					*(*uint8)(currPtr) = uint8(uint32(*(*uint8)(currPtr)) + uint32(mappedKey << 1))
Use of unsafe calls should be audited
 28
 29func encrypt() {
 30    for _, packet := range decryptedPackets {
 31		ptr := unsafe.Pointer(packet) 32        j := uint16(4)
 33        key := int(uint8(keys[uint16(packet.key) << 1]))
 34        for ; j < packet.size; j++ {