Early check to avoid null deref on files with missing buffer ##bin

* Caused by a bug when xtr plugin doesnt provide the right data back
This commit is contained in:
Sergi Àlvarez i Capilla 2022-07-08 12:27:20 +02:00 committed by pancake
parent 0fe2fab15c
commit 3e8bea04eb

View File

@ -350,6 +350,10 @@ static int rabin_do_operation(RBin *bin, const char *op, int rad, const char *ou
}
RBinFile *bf = r_bin_cur (bin);
if (bf) {
if (!bf->buf) {
R_LOG_ERROR ("Missing data buffer");
return false;
}
RBuffer *nb = r_buf_new_with_buf (bf->buf);
r_buf_free (bf->buf);
bf->buf = nb;