Rednet crash using malformed dns message.
Wojbie opened this issue ยท 5 comments
In line 245 of rednet api:
if sProtocol == "dns" and tMessage.sType == "lookup" then
If rednet is open and computer receives message on sProtocol = "dns" but tMessage if different type from table (like string or number) this line crashes/turns off the computer by causing rednet.run to error.
It can be simply fixed by adding type() test in said line. Per example:
if sProtocol == "dns" and type(tMessage) == "table" and tMessage.sType == "lookup" then
In version 1.76pr3 the rednet file was returned to state before the fix.
So Unfixed as of 1.76pr3?
except... this isn't true:
https://github.com/MKlegoman357/ComputerCraftChanges/blob/master/lua/rom/apis/rednet
yea.. code you posted is not fixed one. line 245 is:
if sProtocol == "dns" and tMessage.sType == "lookup" then
and that allows dns message that is not a table to cause crash.
IF tMessage is a number then it crashes cause you are trying to treat number as table.
This avoids problem:
if sProtocol == "dns" and type(tMessage) == "table" and tMessage.sType == "lookup" then
Edit. Extracted from clean download of pr3: http://pastebin.com/xTXvNmyE
Line 245 is still broken.