X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=lib%2Fstrto.c;h=e93a4f5491c3263ae179f6430476996538026328;hb=6121a54d603d03da2da87b10881a30a61a8614a3;hp=a6c01574dac3f6994cc3121f5d15082ad44e5155;hpb=e6ac28b60be2d670948332197862e314b7977177;p=people%2Fms%2Fu-boot.git diff --git a/lib/strto.c b/lib/strto.c index a6c01574da..e93a4f5491 100644 --- a/lib/strto.c +++ b/lib/strto.c @@ -160,9 +160,11 @@ long trailing_strtoln(const char *str, const char *end) if (!end) end = str + strlen(str); - for (p = end - 1; p > str; p--) { - if (!isdigit(*p)) - return simple_strtoul(p + 1, NULL, 10); + if (isdigit(end[-1])) { + for (p = end - 1; p > str; p--) { + if (!isdigit(*p)) + return simple_strtoul(p + 1, NULL, 10); + } } return -1;