Hi,
   I've been using radare to edit multibyte characters in text files,
and I've found that the support for the resize command's "strip N bytes"
option ("r -#", as mentioned in the section 3.8 of the docs) varies
between versions:

ired works as intended (syntax "r-#")

In radare2, "r" isn't supported at all.  Commented-out code suggests
that it may be handled by a plugin, though I can't see anything relevant
in radare2-extras.

radare interprets -N wrongly:  get_math() returns unsigned values, and
-N becomes (offset - N), so if offset > N, the size is made negative by
the following line in radare_resize()
------
                size = -size; // be positive
------
resulting in the file being extended.

Changing that line to
------
                size = get_math(arg+1);
------
fixes it for me.

Another feature that I think might be useful here is a matching
 r +#
syntax to insert bytes, shifting the rest of the file up.

I suppose this isn't a commonly-used function on files containing
executable code, but it's something I occasionally need when editing
data streams.  Is there another obvious way of doing this that I've
missed?  And if not, is it worth me hacking about further and submitting
some patches, for either version?

Glyn
_______________________________________________
radare mailing list
[email protected]
http://lists.nopcode.org/listinfo.cgi/radare-nopcode.org

Reply via email to