android: Fix off-by-one error when joining strings
When concatenating the strings to form a new command line in the android bootloader flow, the null-terminator was placed one byte after the end of the allocated string. Bug: None Test: booted a rpi3. Change-Id: I120e09a77bb1c27980e7ce2b5f9b8961424ed0c3
This commit is contained in:
parent
180cc7c601
commit
170e9eb9d1
|
|
@ -35,7 +35,7 @@ static int do_android_ab_select(cmd_tbl_t *cmdtp, int flag, int argc,
|
|||
/* Android standard slot names are 'a', 'b', ... */
|
||||
slot[0] = ANDROID_BOOT_SLOT_NAME(ret);
|
||||
slot[1] = '\0';
|
||||
setenv(argv[1], slot);
|
||||
env_set(argv[1], slot);
|
||||
printf("ANDROID: Booting slot: %s\n", slot);
|
||||
return CMD_RET_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -200,7 +200,8 @@ static char *strjoin(const char **chunks, char separator)
|
|||
*current = separator;
|
||||
current++;
|
||||
}
|
||||
*current = '\0';
|
||||
/* Replace the last separator by a \0. */
|
||||
current[-1] = '\0';
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue