Skip to content

Commit

Permalink
Fix #40: Hangs when receiving a value > 250 bytes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Sabalausky authored and Nick Sabalausky committed May 30, 2014
1 parent 2e97d24 commit 1dd2996
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion source/mysql/connection.d
Original file line number Diff line number Diff line change
Expand Up @@ -1373,7 +1373,17 @@ body
if(lcb.isNull || lcb.isIncomplete)
return lcb;
assert(packet.length >= lcb.totalBytes);
lcb.value = packet.decode!ulong(lcb.numBytes);

if(lcb.numBytes == 0)
lcb.value = 0;
else if(lcb.numBytes == 1)
lcb.value = packet.decode!ulong(lcb.numBytes);
else
{
// Skip the throwaway byte that indicated "at least 2 more bytes coming"
lcb.value = packet[1..$].decode!ulong(lcb.numBytes);
}

return lcb;
}

Expand Down

0 comments on commit 1dd2996

Please sign in to comment.