aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRasmus Villemoes <rasmus.villemoes@prevas.dk>2024-01-03 11:47:06 +0100
committerTom Rini <trini@konsulko.com>2024-01-16 17:05:29 -0500
commit92fa22a1bb1e77e05b20e7caa854101bb15ccfef (patch)
treea9fd42e6daf0861a1151d2b601e246996eb035c7
parent48f31ee7427f7e2b87b5b9cf9b86e3b411acf8f0 (diff)
downloadu-boot-92fa22a1bb1e77e05b20e7caa854101bb15ccfef.zip
u-boot-92fa22a1bb1e77e05b20e7caa854101bb15ccfef.tar.gz
u-boot-92fa22a1bb1e77e05b20e7caa854101bb15ccfef.tar.bz2
cmd/command.c: relax length check in cmd_get_data_size()
Just check that the length is at least 2. This allows passing strings like ".b", which can be convenient when constructing tests (i.e. parametrizing the suffix used). Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
-rw-r--r--common/command.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/command.c b/common/command.c
index 83feaac..af8ffdb 100644
--- a/common/command.c
+++ b/common/command.c
@@ -470,7 +470,7 @@ int cmd_get_data_size(const char *arg, int default_size)
/* Check for a size specification .b, .w or .l.
*/
int len = strlen(arg);
- if (len > 2 && arg[len-2] == '.') {
+ if (len >= 2 && arg[len-2] == '.') {
switch (arg[len-1]) {
case 'b':
return 1;