summaryrefslogtreecommitdiff
path: root/source3/rpc_parse/parse_lsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpc_parse/parse_lsa.c')
-rw-r--r--source3/rpc_parse/parse_lsa.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c
index 06ccec4ab3..0add8b2bb0 100644
--- a/source3/rpc_parse/parse_lsa.c
+++ b/source3/rpc_parse/parse_lsa.c
@@ -1178,7 +1178,7 @@ static BOOL lsa_io_sid_enum(const char *desc, LSA_SID_ENUM *sen, prs_struct *ps,
/* Mallocate memory if we're unpacking from the wire */
- if (UNMARSHALLING(ps)) {
+ if (UNMARSHALLING(ps) && sen->num_entries) {
if ((sen->ptr_sid = PRS_ALLOC_MEM( ps, uint32, sen->num_entries)) == NULL) {
DEBUG(3, ("init_lsa_sid_enum(): out of memory for "
"ptr_sid\n"));
@@ -1361,7 +1361,7 @@ static BOOL lsa_io_trans_names(const char *desc, LSA_TRANS_NAME_ENUM *trn,
return False;
}
- if (UNMARSHALLING(ps)) {
+ if (UNMARSHALLING(ps) && trn->num_entries2) {
if ((trn->name = PRS_ALLOC_MEM(ps, LSA_TRANS_NAME, trn->num_entries2)) == NULL) {
return False;
}
@@ -1423,7 +1423,7 @@ static BOOL lsa_io_trans_names2(const char *desc, LSA_TRANS_NAME_ENUM2 *trn,
return False;
}
- if (UNMARSHALLING(ps)) {
+ if (UNMARSHALLING(ps) && trn->num_entries2) {
if ((trn->name = PRS_ALLOC_MEM(ps, LSA_TRANS_NAME2, trn->num_entries2)) == NULL) {
return False;
}
@@ -1700,7 +1700,7 @@ BOOL lsa_io_r_lookup_names(const char *desc, LSA_R_LOOKUP_NAMES *out, prs_struct
return False;
}
- if (UNMARSHALLING(ps)) {
+ if (UNMARSHALLING(ps) && out->num_entries2) {
if ((out->dom_rid = PRS_ALLOC_MEM(ps, DOM_RID, out->num_entries2))
== NULL) {
DEBUG(3, ("lsa_io_r_lookup_names(): out of memory\n"));
@@ -1825,7 +1825,7 @@ BOOL lsa_io_r_lookup_names2(const char *desc, LSA_R_LOOKUP_NAMES2 *out, prs_stru
return False;
}
- if (UNMARSHALLING(ps)) {
+ if (UNMARSHALLING(ps) && out->num_entries2) {
if ((out->dom_rid = PRS_ALLOC_MEM(ps, DOM_RID2, out->num_entries2))
== NULL) {
DEBUG(3, ("lsa_io_r_lookup_names2(): out of memory\n"));
@@ -1978,7 +1978,7 @@ BOOL lsa_io_r_lookup_names3(const char *desc, LSA_R_LOOKUP_NAMES3 *out, prs_stru
return False;
}
- if (UNMARSHALLING(ps)) {
+ if (UNMARSHALLING(ps) && out->num_entries2) {
if ((out->trans_sids = PRS_ALLOC_MEM(ps, LSA_TRANSLATED_SID3, out->num_entries2))
== NULL) {
DEBUG(3, ("lsa_io_r_lookup_names3(): out of memory\n"));
@@ -2107,7 +2107,7 @@ BOOL lsa_io_r_lookup_names4(const char *desc, LSA_R_LOOKUP_NAMES4 *out, prs_stru
return False;
}
- if (UNMARSHALLING(ps)) {
+ if (UNMARSHALLING(ps) && out->num_entries2) {
if ((out->trans_sids = PRS_ALLOC_MEM(ps, LSA_TRANSLATED_SID3, out->num_entries2))
== NULL) {
DEBUG(3, ("lsa_io_r_lookup_names4(): out of memory\n"));
@@ -2346,7 +2346,7 @@ BOOL lsa_io_r_enum_privs(const char *desc, LSA_R_ENUM_PRIVS *out, prs_struct *ps
if(!prs_uint32("count1", ps, depth, &out->count1))
return False;
- if (UNMARSHALLING(ps))
+ if (UNMARSHALLING(ps) && out->count1)
if (!(out->privs = PRS_ALLOC_MEM(ps, LSA_PRIV_ENTRY, out->count1)))
return False;
@@ -3908,7 +3908,7 @@ static BOOL smb_io_lsa_data_buf(const char *desc, LSA_DATA_BUF *buf,
prs_debug(ps, depth, desc, "smb_io_lsa_data_buf");
depth++;
- if ( UNMARSHALLING(ps) ) {
+ if ( UNMARSHALLING(ps) && length ) {
if ( !(buf->data = PRS_ALLOC_MEM( ps, uint8, length )) )
return False;
}
@@ -3922,7 +3922,7 @@ static BOOL smb_io_lsa_data_buf(const char *desc, LSA_DATA_BUF *buf,
if (!prs_uint32("length", ps, depth, &buf->length))
return False;
- if(!prs_uint8s(False, "data", ps, depth, buf->data, size))
+ if(!prs_uint8s(False, "data", ps, depth, buf->data, length))
return False;
return True;