Fix overrun in r_buf api

This commit is contained in:
pancake 2014-11-10 02:08:32 +01:00
parent 3c7dbb4ac6
commit 9f570a927b
3 changed files with 5 additions and 2 deletions

View File

@ -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);
}

View File

@ -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);

View File

@ -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;