X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=blobdiff_plain;f=src%2Fstrutil.c;fp=src%2Fstrutil.c;h=be07662f3ec03c95eb8e0afc8b0695ba8afcc82e;hp=c389a524d26598aa20a4274969cbd1bf9c76ae4b;hb=5c462eb3c874ce79ff40eecc3ad9921ede0aad22;hpb=a5800e90ab7154b5179c3d95ac988bda715ebbb2 diff --git a/src/strutil.c b/src/strutil.c index c389a524..be07662f 100644 --- a/src/strutil.c +++ b/src/strutil.c @@ -174,7 +174,7 @@ SR_PRIV int sr_atoul_base(const char *str, unsigned long *ret, char **end, int b /* 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; }