winbindd: Use dom_sid_str_buf
authorVolker Lendecke <vl@samba.org>
Fri, 26 Oct 2018 06:25:14 +0000 (08:25 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 2 Nov 2018 20:21:15 +0000 (21:21 +0100)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/winbindd/winbindd_xids_to_sids.c

index d1424cdb0613489aa16f74da547dcea171083a8d..29caccd04686f648550d16fca6add37b027c4b09 100644 (file)
@@ -113,17 +113,16 @@ NTSTATUS winbindd_xids_to_sids_recv(struct tevent_req *req,
        }
 
        for (i=0; i<state->num_xids; i++) {
-               char sidbuf[DOM_SID_STR_BUFLEN];
+               struct dom_sid_buf sid_buf;
+               const char *str = "-";
 
-               if (is_null_sid(&state->sids[i])) {
-                       strlcpy(sidbuf, "-", sizeof(sidbuf));
-               } else {
-                       dom_sid_string_buf(&state->sids[i],
-                                          sidbuf, sizeof(sidbuf));
+               if (!is_null_sid(&state->sids[i])) {
+                       dom_sid_str_buf(&state->sids[i], &sid_buf);
+                       str = sid_buf.buf;
                }
 
                result = talloc_asprintf_append_buffer(
-                       result, "%s\n", sidbuf);
+                       result, "%s\n", str);
                if (result == NULL) {
                        return NT_STATUS_NO_MEMORY;
                }