diff options
author | Michael Heimpold <michael.heimpold@i2se.com> | 2018-12-18 14:52:12 +0100 |
---|---|---|
committer | Chris Ball <chris@printf.net> | 2019-10-04 20:47:27 -0400 |
commit | c19c7694d21c2d5b2878954eac8bc55a9bd639e7 (patch) | |
tree | 87dfeaaf47009ec8a59a8192558ae039740492b8 | |
parent | de27fd97529437331451070c81b226a43507c0a1 (diff) | |
download | mmc-utils-old-c19c7694d21c2d5b2878954eac8bc55a9bd639e7.tar.gz |
Fix parsing of character in to_binstr()
When a hex-digit > 'a' or 'A' is read, we have to add an offset of 10
to access the valid symbol in our mapping table.
Signed-off-by: Michael Heimpold <michael.heimpold@i2se.com>
Cc: Michael Heimpold <mhei@heimpold.de>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Chris Ball <chris@printf.net>
-rw-r--r-- | lsmmc.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -386,9 +386,9 @@ char *to_binstr(char *hexstr) if (isdigit(*hexstr)) strcat(binstr, bindigits[*hexstr - '0']); else if (islower(*hexstr)) - strcat(binstr, bindigits[*hexstr - 'a']); + strcat(binstr, bindigits[*hexstr - 'a' + 10]); else - strcat(binstr, bindigits[*hexstr - 'A']); + strcat(binstr, bindigits[*hexstr - 'A' + 10]); hexstr++; } |