size_t dos_PutUniCode(char *dst,const char *src, ssize_t len, BOOL null_terminate)
{
size_t ret = 0;
- while (*src && (len > 2)) {
+ while (*src && (len >= 2)) {
size_t skip = get_character_len(*src);
smb_ucs2_t val = (*src & 0xff);
#ifdef HAVE_SETGROUPS
sys_setgroups(ngroups, groups);
+#endif
sec_ctx_stack[sec_ctx_stack_ndx].ngroups = ngroups;
+
+ if (sec_ctx_stack[sec_ctx_stack_ndx].groups != NULL)
+ free(sec_ctx_stack[sec_ctx_stack_ndx].groups);
+
sec_ctx_stack[sec_ctx_stack_ndx].groups =
memdup(groups, sizeof(gid_t) * ngroups);
-#endif
become_id(uid, gid);