Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ragg2 gives incorrect input when using -d -w #7

Closed
ericfode opened this issue Aug 1, 2012 · 5 comments
Closed

ragg2 gives incorrect input when using -d -w #7

ericfode opened this issue Aug 1, 2012 · 5 comments
Labels

Comments

@ericfode
Copy link

ericfode commented Aug 1, 2012

if the last character is of the replacement is b it always gets put at the beginning of the string regardless of where you told it to go.

root@protostar:# ragg2 -p A200 -d 50:0xccccccb
cbcccc0c41414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141
root@protostar:
# ragg2 -p A200 -d 50:0xcb
cb00000041414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141
root@protostar:# ragg2 -p A10 -d 50:0xcb
cb000000414141414141
root@protostar:
# ragg2 -p A20 -w 10:cb
cb41414141414141414141414141414141414141

@ericfode
Copy link
Author

ericfode commented Aug 1, 2012

Working on this... It looks like this block of code is the problem
libr\util\num.c:96

} else {
        lch = str[len>0?len-1:0];
        if (*str=='0' && lch != 'b' && lch != 'h')
            lch = 'o';
        switch (lch) {
        case 'h': // hexa
            sscanf (str, "%"PFMT64x"", &ret);
            break;
        case 'o': // octal
            sscanf (str, "%"PFMT64o"", &ret);
            break;
        case 'b': // binary
            ret = 0;
            for (j=0, i=strlen (str)-2; i>=0; i--, j++) {
                if (str[i]=='1') ret|=1<<j;
                else if (str[i]!='0') break;
            }

@radare
Copy link
Collaborator

radare commented Aug 2, 2012

Works fine here. Are you using the git repo or the stable release?

Thanks

On Aug 2, 2012, at 1:14, Eric Fodereply@reply.github.com wrote:

if the last character is of the replacement is b it always gets put at the beginning of the string regardless of where you told it to go.

root@protostar:# ragg2 -p A200 -d 50:0xccccccb
cbcccc0c41414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141
root@protostar:
# ragg2 -p A200 -d 50:0xcb
cb00000041414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141
root@protostar:# ragg2 -p A10 -d 50:0xcb
cb000000414141414141
root@protostar:
# ragg2 -p A20 -w 10:cb
cb41414141414141414141414141414141414141


Reply to this email directly or view it on GitHub:
#7

@ericfode
Copy link
Author

ericfode commented Aug 2, 2012

git repo (just did a git pull to make sure i had the most recent version)

@radare
Copy link
Collaborator

radare commented Aug 2, 2012

You are right. This is a bug. I have puhed a fix. Let me know if its correct for you.

Thx

On Aug 2, 2012, at 1:14, Eric Fodereply@reply.github.com wrote:

if the last character is of the replacement is b it always gets put at the beginning of the string regardless of where you told it to go.

root@protostar:# ragg2 -p A200 -d 50:0xccccccb
cbcccc0c41414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141
root@protostar:
# ragg2 -p A200 -d 50:0xcb
cb00000041414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141
root@protostar:# ragg2 -p A10 -d 50:0xcb
cb000000414141414141
root@protostar:
# ragg2 -p A20 -w 10:cb
cb41414141414141414141414141414141414141


Reply to this email directly or view it on GitHub:
#7

@ericfode ericfode closed this as completed Aug 2, 2012
@ericfode ericfode reopened this Aug 2, 2012
@ericfode
Copy link
Author

ericfode commented Aug 2, 2012

Works for me

@ericfode ericfode closed this as completed Aug 2, 2012
@ghost ghost mentioned this issue Oct 22, 2013
@ghost ghost mentioned this issue Nov 12, 2013
@radare radare mentioned this issue Feb 17, 2014
@radare radare mentioned this issue Sep 27, 2014
@radare radare mentioned this issue Nov 29, 2014
@radare radare mentioned this issue Sep 5, 2018
@ghost ghost mentioned this issue Feb 2, 2019
@radare radare mentioned this issue Mar 12, 2019
This was referenced Mar 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants