* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
#include "includes.h"
extern int DEBUGLEVEL;
/* Now we need to return a non-NULL address for the ace list even
if the number of aces required is zero. This is because there
is a distinct difference between a NULL ace and an ace with zero
- entries in it. This is achieved by always making the number of
- bytes allocated by talloc() positive. Heh. */
+ entries in it. This is achieved by checking that num_aces is a
+ positive number. */
- if((dst->ace = (SEC_ACE *)talloc(ctx, sizeof(SEC_ACE) * num_aces + 1))
- == NULL) {
+ if ((num_aces) &&
+ ((dst->ace = (SEC_ACE *)talloc(ctx, sizeof(SEC_ACE) * num_aces))
+ == NULL)) {
return NULL;
}
-
+
for (i = 0; i < num_aces; i++) {
dst->ace[i] = ace_list[i]; /* Structure copy. */
dst->size += ace_list[i].size;
{
int i, j;
- /* Trivial case */
+ /* Trivial cases */
if (!s1 && !s2) return True;
+ if (!s1 || !s2) return False;
/* Check top level stuff */
offset = SD_HEADER_SIZE;
dst->off_sacl = offset;
- offset += ((sacl->size + 3) & ~3);
+ offset += ((dst->sacl->size + 3) & ~3);
}
if (dst->dacl != NULL) {
offset = SD_HEADER_SIZE;
dst->off_dacl = offset;
- offset += ((dacl->size + 3) & ~3);
+ offset += ((dst->dacl->size + 3) & ~3);
}
*sd_size = (size_t)((offset == 0) ? SD_HEADER_SIZE : offset);