summaryrefslogtreecommitdiff
path: root/source4/lib/tdr
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-09-03 19:43:35 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:36:28 -0500
commit102a6ec95b2487d4ef13de2120be00e2818cce23 (patch)
treef345d2d6d854ef8d64a14b7ee06c73aa7736ae16 /source4/lib/tdr
parent02b3abec25ed0b303906c5dae9dd527171762d9a (diff)
downloadsamba-102a6ec95b2487d4ef13de2120be00e2818cce23.tar.gz
samba-102a6ec95b2487d4ef13de2120be00e2818cce23.tar.bz2
samba-102a6ec95b2487d4ef13de2120be00e2818cce23.zip
r10009: Fix bug in uint8 parsing functions
(This used to be commit abb0db12185a3b3ef7da16fa3d742336afeb8ef0)
Diffstat (limited to 'source4/lib/tdr')
-rw-r--r--source4/lib/tdr/tdr.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/source4/lib/tdr/tdr.c b/source4/lib/tdr/tdr.c
index c16a05ecf0..e55060da25 100644
--- a/source4/lib/tdr/tdr.c
+++ b/source4/lib/tdr/tdr.c
@@ -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;
}