1
0
mirror of https://xff.cz/git/u-boot/ synced 2026-01-25 12:05:21 +01:00

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>
This commit is contained in:
Rasmus Villemoes
2024-01-03 11:47:06 +01:00
committed by Tom Rini
parent 48f31ee742
commit 92fa22a1bb

View File

@@ -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;