The sr_atoul_base() conversion routine only accepted the 0b binary
prefix when base was 0. Extend this to also accept the 0b prefix when
the caller specified base is 2. This unbreaks a valid use case.
/* Add "0b" prefix support which strtol(3) may be missing. */
while (str && isspace(*str))
str++;
- if (!base && strncmp(str, "0b", strlen("0b")) == 0) {
+ if ((!base || base == 2) && strncmp(str, "0b", strlen("0b")) == 0) {
str += strlen("0b");
base = 2;
}