summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/libcli/security/dom_sid.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/source4/libcli/security/dom_sid.c b/source4/libcli/security/dom_sid.c
index 54242eb515..90421104a7 100644
--- a/source4/libcli/security/dom_sid.c
+++ b/source4/libcli/security/dom_sid.c
@@ -285,7 +285,14 @@ char *dom_sid_string(TALLOC_CTX *mem_ctx, const struct dom_sid *sid)
(unsigned int)sid->sid_rev_num, (unsigned long)ia);
for (i = 0; i < sid->num_auths; i++) {
- ofs += snprintf(ret + ofs, maxlen - ofs, "-%lu", (unsigned long)sid->sub_auths[i]);
+ char *tmp = talloc_asprintf(mem_ctx, "%lu",
+ (unsigned long)sid->sub_auths[i]);
+ if (tmp == NULL) {
+ talloc_free(ret);
+ return NULL;
+ }
+ ofs += snprintf(ret + ofs, maxlen - ofs, "-%s", tmp);
+ talloc_free(tmp);
}
return ret;