diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-06-14 17:56:44 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-06-14 18:02:21 +0300 |
commit | 0294661da5b68cd428362fb81513d11471e6a24a (patch) | |
tree | 4f39fda5bfc2857cdc16fcad0cf6b35cf6ce74d6 /py/parsenumbase.c | |
parent | 812025bd8317d520006dd71ab6404edb6df29352 (diff) | |
download | micropython-0294661da5b68cd428362fb81513d11471e6a24a.tar.gz micropython-0294661da5b68cd428362fb81513d11471e6a24a.zip |
parsenum: Signedness issues.
char can be signedness, and using signedness types is dangerous - it can
lead to negative offsets when doing table lookups. We apparently should just
ban char usage.
Diffstat (limited to 'py/parsenumbase.c')
-rw-r--r-- | py/parsenumbase.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/py/parsenumbase.c b/py/parsenumbase.c index 0057e467e5..ce140655bd 100644 --- a/py/parsenumbase.c +++ b/py/parsenumbase.c @@ -31,7 +31,7 @@ // find real radix base, and strip preceding '0x', '0o' and '0b' // puts base in *base, and returns number of bytes to skip the prefix int mp_parse_num_base(const char *str, uint len, int *base) { - const char *p = str; + const byte *p = (const byte*)str; int c = *(p++); if ((*base == 0 || *base == 16) && c == '0') { c = *(p++); @@ -63,6 +63,6 @@ int mp_parse_num_base(const char *str, uint len, int *base) { } p--; } - return p - str; + return p - (const byte*)str; } |