Permalink
Browse files

Fix another rasm2 bug

  • Loading branch information...
1 parent 04f346b commit c6ab7b759d6eca93639e0f113fb121d4658844b9 @radare committed Feb 10, 2014
Showing with 7 additions and 2 deletions.
  1. +3 −2 binr/rasm2/rasm2.c
  2. +2 −0 doc/fortunes
  3. +2 −0 libr/asm/asm.c
View
@@ -345,11 +345,12 @@ int main(int argc, char *argv[]) {
if (length<1) break;
if (len>0 && len < length)
length = len;
+ buf[length] = 0;
if ((!bin || !dis) && feof (stdin))
break;
if (skip && length>skip) {
if (bin) {
- memmove (buf, buf+skip, length-skip);
+ memmove (buf, buf+skip, length-skip+1);
length -= skip;
}
}
@@ -372,7 +373,7 @@ int main(int argc, char *argv[]) {
len = strlen (buf);
if (skip && len>skip) {
skip *= 2;
- eprintf ("SKIP (%s) (%lld)\n", buf, skip);
+ //eprintf ("SKIP (%s) (%lld)\n", buf, skip);
memmove (buf, buf+skip, len-skip);
len -= skip;
buf[len] = 0;
View
@@ -212,3 +212,5 @@ I hope you segfault in hell
May the segfault be with you
I script in C, because fuck you
EXPLICIT CONTENT
+bindings are mostly powered by tears
+In Soviet Russia, Radare have documentation
View
@@ -435,6 +435,7 @@ R_API RAsmCode* r_asm_massemble(RAsm *a, const char *buf) {
return r_asm_code_free (acode);
lbuf = strdup (buf);
+
/* accept ';' as comments when input is multiline */
{
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);
for (idx = ret = i = j = 0, off = a->pc, acode->buf_hex[0] = '\0';
i <= ctr; i++, idx += ret) {
+ memset (buf_token, 0, R_ASM_BUFSIZE);
strncpy (buf_token, tokens[i], R_ASM_BUFSIZE);
for (ptr_start = buf_token; *ptr_start &&
isseparator (*ptr_start); ptr_start++);

0 comments on commit c6ab7b7

Please sign in to comment.