blakadder/nspanel

bug in split_55() ?

peepshow-21 opened this issue · 2 comments


  def split_55(b)
    var ret = []
    var s = size(b)   
    var i = s-1   # start from last
    while i > 0
      if b[i] == 0x55 && b[i+1] == 0xAA           
        ret.push(b[i..s-1]) # push last msg to list
        b = b[(0..i-1)]   # write the rest back to b
      end
      i -= 1
    end
    ret.push(b)
    return ret
  end

should be like this i think;

        ret.push(b[(i+2)..s-1]) # push last msg to list

I think it needs that or the split message will still have the split chars in the messsage

you think or you're certain? what kind of testing makes you think that?