strsep unlike strtok(_r) returns an empty string for each pair of
consecutive delimiters.
blspec_apply_oftree_overlay is not equipped to handle an empty
string and will attempt treating "abspath/" as device tree file.

Explicitly check for empty strings, so this doesn't happen.

Cc: Michael Tretter <[email protected]>
Signed-off-by: Ahmad Fatoum <[email protected]>
---
Change is untested
---
 common/blspec.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/common/blspec.c b/common/blspec.c
index 9e1036c8342c..ed66352d1107 100644
--- a/common/blspec.c
+++ b/common/blspec.c
@@ -109,8 +109,11 @@ static void blspec_apply_oftree_overlays(const char 
*overlays,
 
        sep = freep = xstrdup(overlays);
 
-       while ((overlay = strsep(&sep, " ")))
+       while ((overlay = strsep(&sep, " "))) {
+               if (!*overlay)
+                       continue;
                blspec_apply_oftree_overlay(overlay, abspath, dryrun);
+       }
 
        free(freep);
 }
-- 
2.28.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to