1
0
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:
Jeremy Allison 2006-06-13 18:09:04 +00:00 committed by Gerald (Jerry) Carter
parent 3a7d01afbe
commit 98751e8190

View File

@ -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);