*/
_PUBLIC_ enum ndr_err_code ndr_push_DATA_BLOB(struct ndr_push *ndr, ndr_flags_type ndr_flags, DATA_BLOB blob)
{
+ static const uint8_t padding[8] = { 0, };
+
if (ndr->flags & LIBNDR_FLAG_REMAINING) {
/* nothing to do */
} else if (ndr->flags & (LIBNDR_ALIGN_FLAGS & ~LIBNDR_FLAG_NOALIGN)) {
+ blob.data = discard_const_p(uint8_t, padding);
if (ndr->flags & LIBNDR_FLAG_ALIGN2) {
blob.length = NDR_ALIGN(ndr, 2);
} else if (ndr->flags & LIBNDR_FLAG_ALIGN4) {
blob.length = NDR_ALIGN(ndr, 4);
} else if (ndr->flags & LIBNDR_FLAG_ALIGN8) {
blob.length = NDR_ALIGN(ndr, 8);
+ } else {
+ return ndr_push_error(ndr,
+ NDR_ERR_LENGTH,
+ "Invalid align flags");
}
- NDR_PUSH_ALLOC_SIZE(ndr, blob.data, blob.length);
- data_blob_clear(&blob);
} else {
NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, blob.length));
}