rednet modifies any bytes with a value > 127
First line being 01 -> 16
Every other line being hex representation of the byte at that position in the message.
Steps to Reproduce Bug:
rednet.send(id, string.char(n)) where n > 127
Client code, program has only one argument the id of the computer to send the data to.
local l = ""
for n,side in pairs(rs.getSides()) do
if peripheral.getType(side) == "modem" then
rednet.open(side)
open = true
break
end
end
for i = 127 - 15, 127 + 16 * 4 do
l = l .. string.char(i)
end
local args = {...}
rednet.send(tonumber(args[1]), l)
function memdmp(data)
write("01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16\n")
for i = 1, #data do
write(string.format("%.2x ", string.byte(data:sub(i,i))))
if i % 16 == 0 then
print()
end
if i % 256 == 0 then
print("Press any key to continue")
os.pullEvent()
write("01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16\n")
end
end
print()
end
memdmp(l)
Server code
for n,side in pairs(rs.getSides()) do
if peripheral.getType(side) == "modem" then
rednet.open(side)
open = true
break
end
end
local event, p1, p2 = os.pullEvent()
function memdmp(data)
write("01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16\n")
for i = 1, #data do
write(string.format("%.2x ", string.byte(data:sub(i,i))))
if i % 16 == 0 then
print()
end
if i % 256 == 0 then
print("Press any key to continue")
os.pullEvent()
write("01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16\n")
end
end
print()
end
memdmp(p2)