mirror of
https://github.com/samba-team/samba.git
synced 2025-01-24 02:04:21 +03:00
lib: Use talloc_asprintf_addbuf() in str_list_join_shell()
This adds proper NULL checks via talloc_asprintf_addbuf() Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
2c7766c28f
commit
c692b5c95b
@ -210,10 +210,11 @@ _PUBLIC_ char *str_list_join_shell(TALLOC_CTX *mem_ctx, const char **list, char
|
||||
ret = talloc_strdup(mem_ctx, list[0]);
|
||||
|
||||
for (i = 1; list[i]; i++) {
|
||||
if (strchr(list[i], ' ') || strlen(list[i]) == 0)
|
||||
ret = talloc_asprintf_append_buffer(ret, "%c\"%s\"", sep, list[i]);
|
||||
else
|
||||
ret = talloc_asprintf_append_buffer(ret, "%c%s", sep, list[i]);
|
||||
if (strchr(list[i], ' ') || strlen(list[i]) == 0) {
|
||||
talloc_asprintf_addbuf(&ret, "%c\"%s\"", sep, list[i]);
|
||||
} else {
|
||||
talloc_asprintf_addbuf(&ret, "%c%s", sep, list[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
Loading…
x
Reference in New Issue
Block a user