From: Rasmus Villemoes Date: Wed, 3 Jan 2024 10:47:06 +0000 (+0100) Subject: cmd/command.c: relax length check in cmd_get_data_size() X-Git-Url: http://git.dujemihanovic.xyz/img/static/git-favicon.png?a=commitdiff_plain;h=92fa22a1bb1e77e05b20e7caa854101bb15ccfef;p=u-boot.git 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 --- diff --git a/common/command.c b/common/command.c index 83feaac1cb..af8ffdba8f 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;