if (!list_empty(&conf->id_map)) {
int extraargs, hostuid_mapped, hostgid_mapped;
char **n2;
- char txtuid[20], txtgid[20];
+ char *txtuid = NULL, *txtgid = NULL;
struct id_map *map;
int n2args = 1;
/* note n2[n2args-1] is NULL */
n2[n2args - 5] = "--mapped-uid";
+ txtuid = malloc(20);
+ if (!txtuid) {
+ free(newargv);
+ free(n2);
+ _exit(EXIT_FAILURE);
+ }
ret = strnprintf(txtuid, 20, "%d", hostuid_mapped);
if (ret < 0) {
free(newargv);
n2[n2args - 4] = txtuid;
n2[n2args - 3] = "--mapped-gid";
+ txtgid = malloc(20);
+ if (!txtgid) {
+ free(newargv);
+ free(n2);
+ _exit(EXIT_FAILURE);
+ }
ret = strnprintf(txtgid, 20, "%d", hostgid_mapped);
if (ret < 0) {
free(newargv);