Fix uaf in r_asm_op_get_hex ##crash

This commit is contained in:
pancake 2023-03-06 14:26:24 +01:00
parent 08e51ab484
commit e3d0768453

View File

@ -29,8 +29,16 @@ R_DEPRECATE R_API void r_asm_op_fini(RAnalOp *op) {
R_API char *r_asm_op_get_hex(RAnalOp *op) {
r_return_val_if_fail (op && op->bytes, NULL);
const int size = op->size;
if (size < 1) {
return NULL;
}
char* str = calloc (size + 1, 2);
r_hex_bin2str (op->bytes, size, str);
if (str) {
int res = r_hex_bin2str (op->bytes, size, str);
if (res < 1) {
R_FREE (str);
}
}
return str;
}