Fix another rasm2 bug

This commit is contained in:
pancake 2014-02-10 16:09:40 +01:00
parent 04f346b506
commit c6ab7b759d
3 changed files with 7 additions and 2 deletions

View File

@ -345,11 +345,12 @@ int main(int argc, char *argv[]) {
if (length<1) break; if (length<1) break;
if (len>0 && len < length) if (len>0 && len < length)
length = len; length = len;
buf[length] = 0;
if ((!bin || !dis) && feof (stdin)) if ((!bin || !dis) && feof (stdin))
break; break;
if (skip && length>skip) { if (skip && length>skip) {
if (bin) { if (bin) {
memmove (buf, buf+skip, length-skip); memmove (buf, buf+skip, length-skip+1);
length -= skip; length -= skip;
} }
} }
@ -372,7 +373,7 @@ int main(int argc, char *argv[]) {
len = strlen (buf); len = strlen (buf);
if (skip && len>skip) { if (skip && len>skip) {
skip *= 2; skip *= 2;
eprintf ("SKIP (%s) (%lld)\n", buf, skip); //eprintf ("SKIP (%s) (%lld)\n", buf, skip);
memmove (buf, buf+skip, len-skip); memmove (buf, buf+skip, len-skip);
len -= skip; len -= skip;
buf[len] = 0; buf[len] = 0;

View File

@ -212,3 +212,5 @@ I hope you segfault in hell
May the segfault be with you May the segfault be with you
I script in C, because fuck you I script in C, because fuck you
EXPLICIT CONTENT EXPLICIT CONTENT
bindings are mostly powered by tears
In Soviet Russia, Radare have documentation

View File

@ -435,6 +435,7 @@ R_API RAsmCode* r_asm_massemble(RAsm *a, const char *buf) {
return r_asm_code_free (acode); return r_asm_code_free (acode);
lbuf = strdup (buf); lbuf = strdup (buf);
/* accept ';' as comments when input is multiline */ /* accept ';' as comments when input is multiline */
{ {
char *nl = strchr (lbuf, '\n'); char *nl = strchr (lbuf, '\n');
@ -492,6 +493,7 @@ R_API RAsmCode* r_asm_massemble(RAsm *a, const char *buf) {
r_asm_set_pc (a, pc); r_asm_set_pc (a, pc);
for (idx = ret = i = j = 0, off = a->pc, acode->buf_hex[0] = '\0'; for (idx = ret = i = j = 0, off = a->pc, acode->buf_hex[0] = '\0';
i <= ctr; i++, idx += ret) { i <= ctr; i++, idx += ret) {
memset (buf_token, 0, R_ASM_BUFSIZE);
strncpy (buf_token, tokens[i], R_ASM_BUFSIZE); strncpy (buf_token, tokens[i], R_ASM_BUFSIZE);
for (ptr_start = buf_token; *ptr_start && for (ptr_start = buf_token; *ptr_start &&
isseparator (*ptr_start); ptr_start++); isseparator (*ptr_start); ptr_start++);