mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-25 06:09:50 +00:00
Fix #6715 - NULL dereference
This commit is contained in:
parent
2a80733253
commit
f52b631568
@ -24,7 +24,9 @@ R_API char *r_bin_addr2text(RBin *bin, ut64 addr, int origin) {
|
||||
int line;
|
||||
char *out = NULL, *out2 = NULL;
|
||||
char *file_nopath = NULL;
|
||||
|
||||
if (!bin || !bin->cur) {
|
||||
return NULL;
|
||||
}
|
||||
{
|
||||
char *key = r_str_newf ("0x%"PFMT64x, addr);
|
||||
char *file_line = sdb_get (bin->cur->sdb_addrinfo, key, 0);
|
||||
|
@ -282,10 +282,13 @@ R_API int r_buf_set_bits(RBuffer *b, int bitoff, int bitsize, ut64 value) {
|
||||
}
|
||||
|
||||
R_API int r_buf_set_bytes(RBuffer *b, const ut8 *buf, ut64 length) {
|
||||
if (length <= 0 || !buf) return false;
|
||||
free (b->buf);
|
||||
if (!(b->buf = malloc (length)))
|
||||
if (length <= 0 || !buf) {
|
||||
return false;
|
||||
}
|
||||
free (b->buf);
|
||||
if (!(b->buf = malloc (length))) {
|
||||
return false;
|
||||
}
|
||||
memmove (b->buf, buf, length);
|
||||
|
||||
b->length = length;
|
||||
|
Loading…
Reference in New Issue
Block a user