mirror of
https://github.com/XeonSquared/OC-Copper.git
synced 2024-11-23 01:48:06 +11:00
Fix bug in cdlib where names could be accepted yet truncated.
This commit is contained in:
parent
82903d3655
commit
d18c935db2
@ -18,6 +18,7 @@ local function decodeName(message)
|
||||
if message:len() < 2 then return end
|
||||
local nlen = message:byte(1) + 1
|
||||
local fnam = message:sub(2, nlen + 1)
|
||||
if fnam:len() < nlen then return end
|
||||
return fnam, message:sub(nlen + 2)
|
||||
end
|
||||
|
||||
|
@ -27,7 +27,8 @@ TX.open(4957)
|
||||
TB=TX.broadcast
|
||||
function TN(m)
|
||||
if#m<2then return end
|
||||
local n=m:byte(1)+2return m:sub(2,n),m:sub(n+1)
|
||||
local n,t=m:byte(1)+2t=m:sub(n+1)
|
||||
if#t>=n then return m:sub(2,n),m:sub(n+1)end
|
||||
end
|
||||
function TR(m)
|
||||
local h,s,m,d=m:byte(),TN(m:sub(2))
|
||||
|
@ -2,7 +2,8 @@ S,C,TC=string,component,"copper"
|
||||
function CG(n)return C.proxy(C.list(n)())end
|
||||
TH,TX=CG("eeprom").getLabel(),CG("modem")TX.open(4957)TB=TX.broadcast
|
||||
function TN(m)if#m<2then return end
|
||||
local n=m:byte(1)+2return m:sub(2,n),m:sub(n+1)end
|
||||
local n,t=m:byte(1)+2t=m:sub(n+1)if#t>=n then return m:sub(2,n),m:sub(n+1)end
|
||||
end
|
||||
function TR(m)local h,s,m,d=m:byte(),TN(m:sub(2))if s then
|
||||
d,m=TN(m)if d then
|
||||
return s,d,m
|
||||
|
Loading…
Reference in New Issue
Block a user