summaryrefslogtreecommitdiff
path: root/drivers/dfu/dfu.c
diff options
context:
space:
mode:
authorMasami Hiramatsu <masami.hiramatsu@linaro.org>2022-01-31 05:52:29 +0300
committerTom Rini <trini@konsulko.com>2022-02-11 19:29:23 +0300
commit8db74c153b4e30edc5290da6c7330c63558678d0 (patch)
treee98f5ce256899d325e30abf32939a0d5ac8cc72c /drivers/dfu/dfu.c
parentd8ae90a8d47da2f22041bf9f6fd6d42a598f44ee (diff)
downloadu-boot-8db74c153b4e30edc5290da6c7330c63558678d0.tar.xz
DFU: Accept redundant spaces and tabs in dfu_alt_info
If dfu_alt_info has repeated spaces or tab (for indentation or readability), the dfu fails to parse it. For example, if dfu_alt_info="mtd nor1=image raw 100000 200000" (double spaces after "raw"), the image entity start address is '0' and the size '0x100000'. This is because the repeated space is not skipped. Use space and tab as a separater and apply skip_spaces() to skip redundant spaces and tabs. Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
Diffstat (limited to 'drivers/dfu/dfu.c')
-rw-r--r--drivers/dfu/dfu.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index 66c41b5e76..18154774f9 100644
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
@@ -123,9 +123,10 @@ int dfu_config_interfaces(char *env)
s = env;
while (s) {
ret = -EINVAL;
- i = strsep(&s, " ");
+ i = strsep(&s, " \t");
if (!i)
break;
+ s = skip_spaces(s);
d = strsep(&s, "=");
if (!d)
break;
@@ -502,8 +503,9 @@ static int dfu_fill_entity(struct dfu_entity *dfu, char *s, int alt,
char *st;
debug("%s: %s interface: %s dev: %s\n", __func__, s, interface, devstr);
- st = strsep(&s, " ");
+ st = strsep(&s, " \t");
strlcpy(dfu->name, st, DFU_NAME_SIZE);
+ s = skip_spaces(s);
dfu->alt = alt;
dfu->max_buf_size = 0;