# obtain for "1000" => 31303030 This is what the server is expecting.
# Why? I dunno. How did I come to that conclusion? by looking at rbus
# code. I have no idea how he found that out.
- return Process.uid.to_s.split(//).collect { |a| "%x" % a[0] }.join
+ return Process.uid.to_s.split(//).collect { |a| "%x" % a[0].ord }.join
end
end
# Retrieve the series of bytes until the next NULL (\0) byte.
def get_nul_terminated
- raise IncompleteBufferException if not @buffy[@idx..-1] =~ /^([^\0]*)\0/
+ raise IncompleteBufferException if not @buffy[@idx..-1].ord =~ /^([^\0]*)\0/
str = $1
raise IncompleteBufferException if @idx + str.size + 1 > @buffy.size
@idx += str.size + 1
ret = @buffy.slice(@idx, str_sz)
raise IncompleteBufferException if @idx + str_sz + 1 > @buffy.size
@idx += str_sz
- if @buffy[@idx] != 0
+ if @buffy[@idx].ord != 0
raise InvalidPacketException, "String is not nul-terminated"
end
@idx += 1
ret = @buffy.slice(@idx, str_sz)
raise IncompleteBufferException if @idx + str_sz + 1 >= @buffy.size
@idx += str_sz
- if @buffy[@idx] != 0
+ if @buffy[@idx].ord != 0
raise InvalidPacketException, "Type is not nul-terminated"
end
@idx += 1