X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Fflash%2Fcommon.c;h=072e6912fd45079dff8ca4d76270fd9993233991;hp=253ed9d875b4dfda15bd1df21a2da2b60782b41b;hb=e1ec02bb055fa356b058dddc0a15710e0fdc9870;hpb=870b8c04557f0b7441cc502debaf537984d77e2a 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