Skip to content

Commit 2adff6d

Browse files
committed
fix special case of zero length read
1 parent 7c54931 commit 2adff6d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

projects/RabbitMQ.Client/client/impl/WireFormatting.cs

+5
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,11 @@ public static byte[] ReadLongstr(ReadOnlySpan<byte> span)
189189
public static unsafe string ReadShortstr(ReadOnlySpan<byte> span, out int bytesRead)
190190
{
191191
int byteCount = span[0];
192+
if (byteCount == 0)
193+
{
194+
bytesRead = 1;
195+
return string.Empty;
196+
}
192197
if (span.Length >= byteCount + 1)
193198
{
194199
bytesRead = 1 + byteCount;

0 commit comments

Comments
 (0)