mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-01 00:51:19 +00:00
Fix overrun in r_buf api
This commit is contained in:
parent
3c7dbb4ac6
commit
9f570a927b
@ -259,6 +259,11 @@ R_API ut8 *r_buf_get_at (RBuffer *b, ut64 addr, int *left) {
|
||||
|
||||
R_API int r_buf_read_at(RBuffer *b, ut64 addr, ut8 *buf, int len) {
|
||||
if (!b) return 0;
|
||||
if (addr+len > b->length) {
|
||||
len = b->length - addr;
|
||||
if (len<0)
|
||||
return 0;
|
||||
}
|
||||
return r_buf_cpy (b, addr, buf, b->buf, len, R_FALSE);
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,6 @@ R_API int r_name_filter(char *name, int maxlen) {
|
||||
R_API char *r_name_filter2(const char *name) {
|
||||
int i;
|
||||
char *res;
|
||||
const char *begin = name;
|
||||
while (!IS_PRINTABLE (*name))
|
||||
name++;
|
||||
res = strdup (name);
|
||||
|
@ -205,7 +205,6 @@ R_API void r_print_byte(RPrint *p, const char *fmt, int idx, ut8 ch) {
|
||||
if (!IS_PRINTABLE (ch) && fmt[0]=='%'&&fmt[1]=='c')
|
||||
rch = '.';
|
||||
r_print_cursor (p, idx, 1);
|
||||
//if (p->flags & R_PRINT_FLAGS_CURSOR && idx == p->cur) {
|
||||
if (p && p->flags & R_PRINT_FLAGS_COLOR) {
|
||||
#define P(x) (p->cons &&p->cons->pal.x)?p->cons->pal.x
|
||||
char *color_0x00 = P(b0x00): Color_GREEN;
|
||||
|
Loading…
Reference in New Issue
Block a user