Author: jerry
Date: 2007-05-04 19:44:30 +0000 (Fri, 04 May 2007)
New Revision: 22674

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=22674

Log:
grab jra's samr parsing fix
Modified:
   branches/SAMBA_3_0_RELEASE/source/rpc_parse/parse_samr.c


Changeset:
Modified: branches/SAMBA_3_0_RELEASE/source/rpc_parse/parse_samr.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/rpc_parse/parse_samr.c    2007-05-04 
19:14:51 UTC (rev 22673)
+++ branches/SAMBA_3_0_RELEASE/source/rpc_parse/parse_samr.c    2007-05-04 
19:44:30 UTC (rev 22674)
@@ -4768,9 +4768,14 @@
                if(!prs_uint32("num_sids1", ps, depth, &r_u->num_sids1))
                        return False;
 
-               ptr_sid = TALLOC_ARRAY(ps->mem_ctx, uint32, r_u->num_sids1);
-               if (!ptr_sid) {
-                       return False;
+               /* We must always use talloc here even when marshalling. */
+               if (r_u->num_sids1) {
+                       ptr_sid = TALLOC_ARRAY(ps->mem_ctx, uint32, 
r_u->num_sids1);
+                       if (!ptr_sid) {
+                               return False;
+                       }
+               } else {
+                       ptr_sid = NULL;
                }
                
                for (i = 0; i < r_u->num_sids1; i++) {
@@ -4780,7 +4785,14 @@
                }
                
                if (UNMARSHALLING(ps)) {
-                       r_u->sid = TALLOC_ARRAY(ps->mem_ctx, DOM_SID2, 
r_u->num_sids1);
+                       if (r_u->num_sids1) {
+                               r_u->sid = TALLOC_ARRAY(ps->mem_ctx, DOM_SID2, 
r_u->num_sids1);
+                               if (!r_u->sid) {
+                                       return False;
+                               }
+                       } else {
+                               r_u->sid = NULL;
+                       }
                }
                
                for (i = 0; i < r_u->num_sids1; i++) {

Reply via email to