Fix null deref in r_core_hash_load

This commit is contained in:
pancake 2017-01-14 21:45:13 +01:00
parent a31347369c
commit eb2338ec61

View File

@ -1024,11 +1024,13 @@ R_API int r_core_hash_load(RCore *r, const char *file) {
}
limit = r_config_get_i (r->config, "cfg.hashlimit");
if (r_io_desc_size (r->io, cf->desc) > limit)
if (cf && r_io_desc_size (r->io, cf->desc) > limit) {
return false;
}
buf = (ut8*)r_file_slurp (file, &buf_len);
if (buf==NULL)
if (!buf) {
return false;
}
ctx = r_hash_new (true, R_HASH_MD5);
md5 = r_hash_do_md5 (ctx, buf, buf_len);
p = hash;