Skip to content

Commit

Permalink
Fix array pack string slice
Browse files Browse the repository at this point in the history
Adjust by two characters instead of one to account for endian ordering character as well

Fixes warning in Ruby 3.2 that will be an error in Ruby 3.3 <https://bugs.ruby-lang.org/issues/19150>
  • Loading branch information
Joe-Klauza committed Apr 2, 2023
1 parent ed2e212 commit efadf96
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion admin-interface/lib/rcon-client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def build_packet(body, type=2, id=1, hide_content: false)
packet_body = body
packet_empty_string = ''
packet = [packet_id, packet_type, packet_body, packet_empty_string] # Skip size for now
size = packet.pack(@@pack_string[1..]).length # Get packet size by packing what we have and checking length.
size = packet.pack(@@pack_string[2..]).length # Get packet size by packing what we have and checking length.
packet.unshift(size)
# log "Packet: " << packet.inspect
packed = packet.pack(@@pack_string)
Expand Down

0 comments on commit efadf96

Please sign in to comment.