diff options
author | Zachary T Welch <zw@superlucidity.net> | 2009-11-19 18:11:30 -0800 |
---|---|---|
committer | Zachary T Welch <zw@superlucidity.net> | 2009-11-20 07:10:55 -0800 |
commit | 153848e6cc79241a8da51c1b601c13722b5380a6 (patch) | |
tree | 7fd013c75738d417a4d47d70d64c9fe9e3b85531 /src | |
parent | a1777fc6493b4c1879ef133c565327212859d37c (diff) |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/flash/common.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/flash/common.c b/src/flash/common.c index 253ed9d8..072e6912 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 |