radareorg / r2pipe.rs

Rust crate for r2pipe
Other
45 stars 19 forks source link

r2p.cmd() should trim()? #4

Closed radare closed 8 years ago

radare commented 8 years ago

yup it should, as long as we do the same in the python, node and c# bindings

sushant94 commented 8 years ago

What's the intention of trim()? Since the returned values are String, users may choose to run trim() on the same. Maybe I misunderstand this issue.

radare commented 8 years ago

the problem is that commands sent to the r2pipe endpoint must not contain non-printable chars. mainly because \n can be intepreted as ;, but replying in 2 different responses.which breaks the r2pipe workflow. you can find PoCs for this bug in r2b. also, many ppl use the output of commands as input for another commands. so trimming the output also helps to avoid this situation.

in fact, there’s no sense to run commands with newlines or spaces at the begining or end of the string. So we can fix this with trim. but if those chars are in the middle. the api should fail without sending the command

On 06 Jun 2016, at 16:41, Sushant Dinesh notifications@github.com wrote:

What's the intention of trim()? Since the returned values are String, users may choose to run trim() on the same. Maybe I misunderstand this issue.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/radare/r2pipe.rs/issues/4#issuecomment-223979474, or mute the thread https://github.com/notifications/unsubscribe/AA3-lnWH8w3JjCdm03MYg4AGbjrolHNvks5qJDGVgaJpZM4FoTPf.