diff --git a/channels/smartcard/client/smartcard_pack.c b/channels/smartcard/client/smartcard_pack.c index 4bd7fa66c..11c5dd562 100644 --- a/channels/smartcard/client/smartcard_pack.c +++ b/channels/smartcard/client/smartcard_pack.c @@ -470,7 +470,12 @@ UINT32 smartcard_pack_list_readers_return(SMARTCARD_DEVICE* smartcard, wStream* Stream_Write_UINT32(s, ret->cBytes); /* cBytes (4 bytes) */ Stream_Write_UINT32(s, 0x00020008); /* mszNdrPtr (4 bytes) */ Stream_Write_UINT32(s, ret->cBytes); /* mszNdrLen (4 bytes) */ - Stream_Write(s, ret->msz, ret->cBytes); + + if (ret->msz) + Stream_Write(s, ret->msz, ret->cBytes); + else + Stream_Zero(s, ret->cBytes); + smartcard_pack_write_offset_align(smartcard, s, 4); return SCARD_S_SUCCESS; @@ -973,7 +978,12 @@ UINT32 smartcard_pack_status_return(SMARTCARD_DEVICE* smartcard, wStream* s, Sta Stream_Write_UINT32(s, ret->cbAtrLen); /* cbAtrLen (4 bytes) */ Stream_Write_UINT32(s, ret->cBytes); /* mszReaderNamesNdrLen (4 bytes) */ - Stream_Write(s, ret->mszReaderNames, ret->cBytes); + + if (ret->mszReaderNames) + Stream_Write(s, ret->mszReaderNames, ret->cBytes); + else + Stream_Zero(s, ret->cBytes); + smartcard_pack_write_offset_align(smartcard, s, 4); return SCARD_S_SUCCESS;