sec_desc_size() needs to handle a null secdesc
authorAndrew Tridgell <tridge@samba.org>
Sun, 4 Jun 2000 23:34:11 +0000 (23:34 +0000)
committerAndrew Tridgell <tridge@samba.org>
Sun, 4 Jun 2000 23:34:11 +0000 (23:34 +0000)
(This used to be commit b152d75ea677d4025dcaaf3ae9009db0979dc402)

source3/rpc_parse/parse_sec.c

index 2aba894834fe738527ce2844226fa9031056426c..51cf52f706d1266d057247857d676ba7f92d289f 100644 (file)
@@ -256,7 +256,11 @@ BOOL sec_io_acl(char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth)
 
 size_t sec_desc_size(SEC_DESC *psd)
 {
-       size_t offset = SD_HEADER_SIZE;
+       size_t offset;
+
+       if (!psd) return 0;
+
+       offset = SD_HEADER_SIZE;
 
        if (psd->owner_sid != NULL)
                offset += ((sid_size(psd->owner_sid) + 3) & ~3);
@@ -411,7 +415,6 @@ SEC_DESC *make_standard_sec_desc(DOM_SID *owner_sid, DOM_SID *grp_sid,
                             owner_sid, grp_sid, NULL, dacl, sd_size);
 }
 
-
 /*******************************************************************
  Reads or writes a SEC_DESC structure.
  If reading and the *ppsd = NULL, allocates the structure.