mirror of
https://github.com/samba-team/samba.git
synced 2025-01-27 14:04:05 +03:00
r16199: Fix Klocwork #1 - ensure we test the first
strtok for NULL. Jeremy.
This commit is contained in:
parent
3a7d01afbe
commit
98751e8190
@ -48,16 +48,18 @@ char *ads_build_path(const char *realm, const char *sep, const char *field, int
|
||||
|
||||
strlcpy(ret,field, len);
|
||||
p=strtok(r,sep);
|
||||
strlcat(ret, p, len);
|
||||
|
||||
while ((p=strtok(NULL,sep))) {
|
||||
char *s;
|
||||
if (reverse)
|
||||
asprintf(&s, "%s%s,%s", field, p, ret);
|
||||
else
|
||||
asprintf(&s, "%s,%s%s", ret, field, p);
|
||||
free(ret);
|
||||
ret = s;
|
||||
if (p) {
|
||||
strlcat(ret, p, len);
|
||||
|
||||
while ((p=strtok(NULL,sep))) {
|
||||
char *s;
|
||||
if (reverse)
|
||||
asprintf(&s, "%s%s,%s", field, p, ret);
|
||||
else
|
||||
asprintf(&s, "%s,%s%s", ret, field, p);
|
||||
free(ret);
|
||||
ret = s;
|
||||
}
|
||||
}
|
||||
|
||||
free(r);
|
||||
|
Loading…
x
Reference in New Issue
Block a user