summaryrefslogtreecommitdiff
path: root/source3/rpc_parse
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-04-27 23:18:41 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:19:44 -0500
commit12ba88574bf91bdcc4447bfc3d429b799064bfd9 (patch)
tree17f9b68292eb277da8c71871f8cad332c43d3a5a /source3/rpc_parse
parentfdc0b87083496ae9d6d9d3d1d1a71dddaca24da2 (diff)
downloadsamba-12ba88574bf91bdcc4447bfc3d429b799064bfd9.tar.gz
samba-12ba88574bf91bdcc4447bfc3d429b799064bfd9.tar.bz2
samba-12ba88574bf91bdcc4447bfc3d429b799064bfd9.zip
r22542: Move over to using the _strict varients of the talloc
calls. No functional changes. Looks bigger than it is :-). Jeremy. (This used to be commit f6fa3080fee1b20df9f1968500840a88cf0ee592)
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r--source3/rpc_parse/parse_buffer.c3
-rw-r--r--source3/rpc_parse/parse_eventlog.c4
-rw-r--r--source3/rpc_parse/parse_misc.c2
-rw-r--r--source3/rpc_parse/parse_net.c28
-rw-r--r--source3/rpc_parse/parse_prs.c6
5 files changed, 35 insertions, 8 deletions
diff --git a/source3/rpc_parse/parse_buffer.c b/source3/rpc_parse/parse_buffer.c
index 5643189afe..b66eb9910a 100644
--- a/source3/rpc_parse/parse_buffer.c
+++ b/source3/rpc_parse/parse_buffer.c
@@ -401,6 +401,9 @@ BOOL smb_io_relarraystr(const char *desc, RPC_BUFFER *buffer, int depth, uint16
{
chaine2[l_chaine2] = '\0';
*string=(uint16 *)TALLOC_MEMDUP(prs_get_mem_context(ps),chaine2,realloc_size);
+ if (!*string) {
+ return False;
+ }
SAFE_FREE(chaine2);
}
diff --git a/source3/rpc_parse/parse_eventlog.c b/source3/rpc_parse/parse_eventlog.c
index addf433feb..436f35aff6 100644
--- a/source3/rpc_parse/parse_eventlog.c
+++ b/source3/rpc_parse/parse_eventlog.c
@@ -354,7 +354,9 @@ BOOL eventlog_io_r_read_eventlog(const char *desc,
/* Now pad with whitespace until the end of the response buffer */
if (q_u->max_read_size - r_u->num_bytes_in_resp) {
- r_u->end_of_entries_padding = SMB_CALLOC_ARRAY(uint8, q_u->max_read_size - r_u->num_bytes_in_resp);
+ if (!r_u->end_of_entries_padding) {
+ return False;
+ }
if(!(prs_uint8s(False, "end of entries padding", ps,
depth, r_u->end_of_entries_padding,
diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c
index efc5274f45..a42915aa08 100644
--- a/source3/rpc_parse/parse_misc.c
+++ b/source3/rpc_parse/parse_misc.c
@@ -221,7 +221,7 @@ BOOL smb_io_dom_sid2_p(const char *desc, prs_struct *ps, int depth, DOM_SID2 **s
if (UNMARSHALLING(ps)) {
if ( !(*sid2 = PRS_ALLOC_MEM(ps, DOM_SID2, 1)) )
- return False;
+ return False;
}
return True;
diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c
index 3eb31ad55f..b3331c8369 100644
--- a/source3/rpc_parse/parse_net.c
+++ b/source3/rpc_parse/parse_net.c
@@ -2995,7 +2995,16 @@ static BOOL net_io_sam_privs_info(const char *desc, SAM_DELTA_PRIVS *info,
if(!prs_uint32("attribute_count", ps, depth, &info->attribute_count))
return False;
- info->attributes = TALLOC_ARRAY(ps->mem_ctx, uint32, info->attribute_count);
+ if (UNMARSHALLING(ps)) {
+ if (info->attribute_count) {
+ info->attributes = TALLOC_ARRAY(ps->mem_ctx, uint32, info->attribute_count);
+ if (!info->attributes) {
+ return False;
+ }
+ } else {
+ info->attributes = NULL;
+ }
+ }
for (i=0; i<info->attribute_count; i++)
if(!prs_uint32("attributes", ps, depth, &info->attributes[i]))
@@ -3004,8 +3013,21 @@ static BOOL net_io_sam_privs_info(const char *desc, SAM_DELTA_PRIVS *info,
if(!prs_uint32("privlist_count", ps, depth, &info->privlist_count))
return False;
- info->hdr_privslist = TALLOC_ARRAY(ps->mem_ctx, UNIHDR, info->privlist_count);
- info->uni_privslist = TALLOC_ARRAY(ps->mem_ctx, UNISTR2, info->privlist_count);
+ if (UNMARSHALLING(ps)) {
+ if (info->privlist_count) {
+ info->hdr_privslist = TALLOC_ARRAY(ps->mem_ctx, UNIHDR, info->privlist_count);
+ info->uni_privslist = TALLOC_ARRAY(ps->mem_ctx, UNISTR2, info->privlist_count);
+ if (!info->hdr_privslist) {
+ return False;
+ }
+ if (!info->uni_privslist) {
+ return False;
+ }
+ } else {
+ info->hdr_privslist = NULL;
+ info->uni_privslist = NULL;
+ }
+ }
for (i=0; i<info->privlist_count; i++)
if(!smb_io_unihdr("hdr_privslist", &info->hdr_privslist[i], ps, depth))
diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c
index 172195f823..bf79c44395 100644
--- a/source3/rpc_parse/parse_prs.c
+++ b/source3/rpc_parse/parse_prs.c
@@ -156,9 +156,9 @@ char *prs_alloc_mem(prs_struct *ps, size_t size, unsigned int count)
{
char *ret = NULL;
- if (size) {
+ if (size && count) {
/* We can't call the type-safe version here. */
- ret = (char *)_talloc_zero_array(ps->mem_ctx, size, count,
+ ret = (char *)_talloc_zero_array_strict(ps->mem_ctx, size, count,
"parse_prs");
}
return ret;
@@ -1825,7 +1825,7 @@ return the contents of a prs_struct in a DATA_BLOB
BOOL prs_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx)
{
blob->length = prs_data_size(prs);
- blob->data = (uint8 *)talloc_zero_size(mem_ctx, blob->length);
+ blob->data = (uint8 *)TALLOC_ZERO_SIZE(mem_ctx, blob->length);
/* set the pointer at the end of the buffer */
prs_set_offset( prs, prs_data_size(prs) );