Skip to content

Commit cb8f61b

Browse files
authored
Merge pull request #18 from jerryneedell/jerryn_fix_byte
fix potential byte overflow exceptions
2 parents e1fbe45 + 242528d commit cb8f61b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

adafruit_sdcard.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,10 @@ def _cmd(self, cmd, arg=0, crc=0, response_buf=None, data_block=True, wait=True)
230230
# create and send the command
231231
buf = self._cmdbuf
232232
buf[0] = 0x40 | cmd
233-
buf[1] = arg >> 24
234-
buf[2] = arg >> 16
235-
buf[3] = arg >> 8
236-
buf[4] = arg
233+
buf[1] = (arg >> 24) & 0xff
234+
buf[2] = (arg >> 16) & 0xff
235+
buf[3] = (arg >> 8) & 0xff
236+
buf[4] = arg & 0xff
237237
buf[5] = crc
238238

239239
with self._spi as spi:

0 commit comments

Comments
 (0)