From 153848e6cc79241a8da51c1b601c13722b5380a6 Mon Sep 17 00:00:00 2001 From: Zachary T Welch Date: Thu, 19 Nov 2009 18:11:30 -0800 Subject: [PATCH] fix flash/nand name parsing Start driver.num check from end, and make sure the numeric part is actually a number. Fix problems trying to parse bank names. --- src/flash/common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/flash/common.c b/src/flash/common.c index 253ed9d875..072e6912fd 100644 --- a/src/flash/common.c +++ b/src/flash/common.c @@ -25,9 +25,11 @@ unsigned get_flash_name_index(const char *name) { - const char *index = strchr(name, '.'); + const char *index = strrchr(name, '.'); if (NULL == index) return 0; + if (index[1] < '0' || index[1] > '9') + return ~0U; unsigned requested; int retval = parse_uint(index + 1, &requested); // detect parsing error by forcing past end of bank list -- 2.30.2