Attached is a patch to fix the parsing of numbers in rax2 (mentioned in
TODO for 0.9).
The input strings were being parsed for string-final 'd' before
string-initial 'Bx', 'Ox', etc., so hex numbers destined for
binary/octal/etc. output that ended in the digit 'd' (decimal 13) were
wrongly interpreted as the input string for converting binary->decimal.
This resulted in "rax2 Bx1d" being interpreted as "rax2 1d", which is of
course decimal 1. The parsing was corrected by moving the catch-all
string-final 'd' check to after all the string-initial checks.
--
Justin "flux_control" Boffemmyer
Cauldron wizard and general mage
Source Mage GNU/Linux
http://www.sourcemage.org
--- binr/rax2/rax2.c 2011-08-28 04:23:44.000000000 +0900
+++ binr/rax2/rax2.n.c 2011-08-28 04:02:54.000000000 +0900
@@ -138,9 +138,6 @@ static int rax (char *str, int last) {
} else if (str[0]=='b') {
out_mode = 'B';
str++;
- } else if (str[strlen(str)-1]=='d') {
- out_mode = 'I';
- str[strlen(str)-1] = 'b';
} else if (str[0]=='F' && str[1]=='x') {
out_mode = 'F';
*str = '0';
@@ -150,6 +147,9 @@ static int rax (char *str, int last) {
} else if (str[0]=='O' && str[1]=='x') {
out_mode = 'O';
*str = '0';
+ } else if (str[strlen(str)-1]=='d') {
+ out_mode = 'I';
+ str[strlen(str)-1] = 'b';
//TODO: Move print into format_output
} else if (str[strlen(str)-1]=='f') {
unsigned char *p = (unsigned char *)&f;
_______________________________________________
radare mailing list
[email protected]
http://lists.nopcode.org/listinfo.cgi/radare-nopcode.org