1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

r10009: Fix bug in uint8 parsing functions

(This used to be commit abb0db1218)
This commit is contained in:
Jelmer Vernooij 2005-09-03 19:43:35 +00:00 committed by Gerald (Jerry) Carter
parent 02b3abec25
commit 102a6ec95b

View File

@ -36,9 +36,11 @@
#define TDR_BE(tdr) ((tdr)->flags & TDR_BIG_ENDIAN)
#define TDR_CVAL(tdr, ofs) CVAL(tdr->data.data,ofs)
#define TDR_SVAL(tdr, ofs) (TDR_BE(tdr)?RSVAL(tdr->data.data,ofs):SVAL(tdr->data.data,ofs))
#define TDR_IVAL(tdr, ofs) (TDR_BE(tdr)?RIVAL(tdr->data.data,ofs):IVAL(tdr->data.data,ofs))
#define TDR_IVALS(tdr, ofs) (TDR_BE(tdr)?RIVALS(tdr->data.data,ofs):IVALS(tdr->data.data,ofs))
#define TDR_SCVAL(tdr, ofs, v) SCVAL(tdr->data.data,ofs,v)
#define TDR_SSVAL(tdr, ofs, v) do { if (TDR_BE(tdr)) { RSSVAL(tdr->data.data,ofs,v); } else SSVAL(tdr->data.data,ofs,v); } while (0)
#define TDR_SIVAL(tdr, ofs, v) do { if (TDR_BE(tdr)) { RSIVAL(tdr->data.data,ofs,v); } else SIVAL(tdr->data.data,ofs,v); } while (0)
#define TDR_SIVALS(tdr, ofs, v) do { if (TDR_BE(tdr)) { RSIVALS(tdr->data.data,ofs,v); } else SIVALS(tdr->data.data,ofs,v); } while (0)
@ -60,7 +62,7 @@ NTSTATUS tdr_push_expand(struct tdr_push *tdr, uint32_t size)
NTSTATUS tdr_pull_uint8(struct tdr_pull *tdr, uint8_t *v)
{
TDR_PULL_NEED_BYTES(tdr, 1);
SCVAL(tdr->data.data, tdr->offset, *v);
*v = TDR_CVAL(tdr, tdr->offset);
tdr->offset += 1;
return NT_STATUS_OK;
}
@ -68,7 +70,7 @@ NTSTATUS tdr_pull_uint8(struct tdr_pull *tdr, uint8_t *v)
NTSTATUS tdr_push_uint8(struct tdr_push *tdr, const uint8_t *v)
{
TDR_PUSH_NEED_BYTES(tdr, 1);
SCVAL(tdr->data.data, tdr->offset, *v);
TDR_SCVAL(tdr, tdr->offset, *v);
tdr->offset += 1;
return NT_STATUS_OK;
}