mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-21 05:05:48 +00:00
Fix segfault and add warning
This commit is contained in:
parent
d83fa5c45d
commit
56dd308d74
@ -1232,6 +1232,10 @@ R_API RBuffer *r_bin_package(RBin *bin, const char *type, const char *file, RLis
|
||||
ut32 num;
|
||||
ut8 *num8 = (ut8*)#
|
||||
RBuffer *buf = r_buf_new_file (file, true);
|
||||
if (!buf) {
|
||||
eprintf ("Cannot open file %s - Permission Denied.\n", file);
|
||||
return NULL;
|
||||
}
|
||||
r_buf_write_at (buf, 0, (const ut8*)"\xca\xfe\xba\xbe", 4);
|
||||
int count = r_list_length (files);
|
||||
|
||||
|
@ -786,10 +786,9 @@ R_API int r_buf_fread_at (RBuffer *b, ut64 addr, ut8 *buf, const char *fmt, int
|
||||
|
||||
//ret 0 or -1 if failed; ret copied length if success
|
||||
R_API int r_buf_write_at(RBuffer *b, ut64 addr, const ut8 *buf, int len) {
|
||||
r_return_val_if_fail (b && buf && len > 0, 0);
|
||||
|
||||
RIOBind *iob = b->iob;
|
||||
if (!b || !buf || len < 1) {
|
||||
return 0;
|
||||
}
|
||||
ut64 start = addr - b->base + b->offset;
|
||||
ut64 effective_size = r_buf_size (b);
|
||||
int real_len = len;
|
||||
|
Loading…
x
Reference in New Issue
Block a user