Skip to content

Commit

Permalink
- fix critical bag
Browse files Browse the repository at this point in the history
for funcs writeVString* have to be used unsigned char for unpack
t3ran13 committed Feb 18, 2018
1 parent 3286f35 commit fa66f87
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/t3ran13/ByteBuffer/ByteBuffer.php
Original file line number Diff line number Diff line change
@@ -131,7 +131,7 @@ public function writeVStringLE($value, $offset = null) {
if ($offset === null) {
$offset = $this->currentOffset;
}
$bytes = unpack('c*', $value); //string to bytes in int
$bytes = unpack('C*', $value); //string to bytes in int
$total = count($bytes);
for ($i = 0; $i < $total; $i++) {
$this->buffer[$offset++] = pack('H*', base_convert($bytes[$i+1], 10, 16));
@@ -156,7 +156,7 @@ public function writeVStringBE($value, $offset = null) {
if ($offset === null) {
$offset = $this->currentOffset;
}
$bytes = unpack('c*', $value); //string to bytes in int
$bytes = unpack('C*', $value); //string to bytes in int
$total = count($bytes);
for ($i = 0; $i < $total; $i++) {
$this->buffer[$offset++] = pack('h*', base_convert($bytes[$i+1], 10, 16));

0 comments on commit fa66f87

Please sign in to comment.