Skip to content

Commit 64c82fe

Browse files
committed
emsmdb: add remark about NDR array sizes to emsmdb_ndr_pull_ecdorpcext2
1 parent 31135a8 commit 64c82fe

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

exch/emsmdb/emsmdb_ndr.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,18 @@ static pack_result emsmdb_ndr_pull_ecdorpcext2(NDR_PULL *pndr, ECDORPCEXT2_IN *r
182182

183183
TRY(pndr->g_ctx_handle(&r->cxh));
184184
TRY(pndr->g_uint32(&r->flags));
185+
/*
186+
* NDR Transfer Syntax (C706, §14.3.3.2 & §14.3.3.3) specifies the
187+
* encoding of arrays. It makes sense in the context of serializing
188+
* e.g. a std::vector<> object. But: C706 does not mention any
189+
* object-oriented language and focuses heavily on ISO C instead, where
190+
* the programmer has to manage an array's size manually, e.g.
191+
* struct S { size_t z; [length_is(z)] uint32_t *array; };, and
192+
* NDR-encoding such a NDR struct then unfortunately causes the length
193+
* to be encoded twice.
194+
*
195+
* Anecdotes: https://lists.samba.org/archive/samba-technical/2009-April/064319.html
196+
*/
185197
TRY(pndr->g_ulong(&size));
186198
r->pin = ndr_stack_anew<uint8_t>(NDR_STACK_IN, size);
187199
if (r->pin == nullptr)

0 commit comments

Comments
 (0)