summaryrefslogtreecommitdiffstats
path: root/source3/winbindd/winbindd_async.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-08-02 17:17:27 +0200
committerVolker Lendecke <vl@samba.org>2009-08-05 03:21:24 -0400
commitf09a95aaff4542df4225f3828a0d737497f0f2e8 (patch)
tree0daccb0969e18de81ff4227ca34e9e045586a841 /source3/winbindd/winbindd_async.c
parentff3ce9016a43906df55a0922f0697c91d255de88 (diff)
downloadsamba-f09a95aaff4542df4225f3828a0d737497f0f2e8.tar.gz
samba-f09a95aaff4542df4225f3828a0d737497f0f2e8.tar.xz
samba-f09a95aaff4542df4225f3828a0d737497f0f2e8.zip
s3:winbind: Make parse_sidlist take a const char *
Diffstat (limited to 'source3/winbindd/winbindd_async.c')
-rw-r--r--source3/winbindd/winbindd_async.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/source3/winbindd/winbindd_async.c b/source3/winbindd/winbindd_async.c
index f53875f6171..094602160d9 100644
--- a/source3/winbindd/winbindd_async.c
+++ b/source3/winbindd/winbindd_async.c
@@ -632,25 +632,32 @@ bool print_sidlist(TALLOC_CTX *mem_ctx, const DOM_SID *sids,
return True;
}
-bool parse_sidlist(TALLOC_CTX *mem_ctx, char *sidstr,
+bool parse_sidlist(TALLOC_CTX *mem_ctx, const char *sidstr,
DOM_SID **sids, size_t *num_sids)
{
- char *p, *q;
+ const char *p, *q;
p = sidstr;
if (p == NULL)
return False;
while (p[0] != '\0') {
+ fstring tmp;
+ size_t sidlen;
DOM_SID sid;
q = strchr(p, '\n');
if (q == NULL) {
DEBUG(0, ("Got invalid sidstr: %s\n", p));
return False;
}
- *q = '\0';
+ sidlen = PTR_DIFF(q, p);
+ if (sidlen >= sizeof(tmp)-1) {
+ return false;
+ }
+ memcpy(tmp, p, sidlen);
+ tmp[sidlen] = '\0';
q += 1;
- if (!string_to_sid(&sid, p)) {
+ if (!string_to_sid(&sid, tmp)) {
DEBUG(0, ("Could not parse sid %s\n", p));
return False;
}