Skip to content

Commit a91ce74

Browse files
committed
fix apilist.txt and 'literal.txt` files search paths (#55);
ignore clang 'nontrivial-memaccess' warning
1 parent 267bd6e commit a91ce74

7 files changed

Lines changed: 31 additions & 18 deletions

File tree

ida-plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"plugin": {
44
"name": "hrtng",
55
"entryPoint": "hrtng",
6-
"version": "3.8.93",
6+
"version": "3.8.94",
77
"idaVersions": ">=7.3",
88
"categories": ["decompilation", "deobfuscation", "malware-analysis"],
99
"description" : "IDA Pro plugin with a rich set of features: decryption, deobfuscation, patching, lib code recognition and various pseudocode transformations",

src/apihashes.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,8 @@ void apihashes_init()
464464
static ushort alg = 0;
465465
static int64 basis = 0;
466466
static int64 prime = 0;
467-
char buf[4096];
468-
getsysfile(buf, 4096, "apilist.txt", PLG_SUBDIR);
467+
char buf[QMAXPATH];
468+
getPluginsFile(buf, QMAXPATH, "apilist.txt");
469469
qstring format =
470470
"STARTITEM 1\n"
471471
//title

src/helpers.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <hexrays.hpp>
2525
#include <bytes.hpp>
2626
#include <kernwin.hpp>
27+
#include <diskio.hpp>
2728
#include <pro.h>
2829
#include "warn_on.h"
2930

@@ -790,3 +791,12 @@ int LogTail(LogLevel level, const char *fmt, ...)
790791
va_end(va);
791792
return res;
792793
}
794+
795+
//------------------------------------------------
796+
char* getPluginsFile(char *buf, size_t bufsize, const char *filename)
797+
{
798+
char *res = getsysfile(buf, bufsize, filename, PLG_SUBDIR "/hrtng");
799+
if(res)
800+
return res;
801+
return getsysfile(buf, bufsize, filename, PLG_SUBDIR);
802+
}

src/helpers.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,3 +282,5 @@ qstring unique_nameC(const char* name, const char* separator, IsUniqueFunc isUni
282282
Log(llError, "FIXME! unique_nameC '%s' is not unique\n", uName.c_str());
283283
return uName;
284284
}
285+
286+
char* getPluginsFile(char *buf, size_t bufsize, const char *filename);

src/hrtng.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5846,7 +5846,7 @@ plugmod_t*
58465846
addon.producer = "Sergey Belov and Hex-Rays SA, Milan Bohacek, J.C. Roberts, Alexander Pick, Rolf Rolles, Takahiro Haruyama," \
58475847
" Karthik Selvaraj, Ali Rahbar, Ali Pezeshk, Elias Bachaalany, Markus Gaasedelen";
58485848
addon.url = "https://github.com/KasperskyLab/hrtng";
5849-
addon.version = "3.8.93";
5849+
addon.version = "3.8.94";
58505850
msg("[hrt] %s (%s) v%s for IDA%d\n", addon.id, addon.name, addon.version, IDA_SDK_VERSION);
58515851

58525852
if(inited) {

src/lit.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ class ida_local literal_db
6767
public:
6868

6969
lit_func_t find_func(const char* funcname) const {
70-
return m_functions.find(funcname);
70+
return m_functions.find(funcname);
7171
}
72-
bool is_func(const lit_func_t& f) const {
73-
return f != m_functions.end();
72+
bool is_func(const lit_func_t& f) const {
73+
return f != m_functions.end();
7474
}
7575
const lit_arg_t* find_arg (const lit_func_t& lfunc, uint32 argN) const
7676
{
@@ -80,8 +80,8 @@ class ida_local literal_db
8080
return NULL;
8181
}
8282

83-
lit_struct_t find_struct(const char* strucname) const {
84-
return m_structures.find(strucname);
83+
lit_struct_t find_struct(const char* strucname) const {
84+
return m_structures.find(strucname);
8585
}
8686
bool is_struct(const lit_struct_t& s) const {
8787
return s != m_structures.end();
@@ -220,7 +220,7 @@ struct ida_local lit_visitor_t : public ctree_visitor_t
220220
bool cmtModified;
221221
user_cmts_t *cmts;
222222

223-
lit_visitor_t(cfunc_t *cfunc) : ctree_visitor_t(CV_FAST), func(cfunc), cmtModified(false)
223+
lit_visitor_t(cfunc_t *cfunc) : ctree_visitor_t(CV_FAST), func(cfunc), cmtModified(false)
224224
{
225225
cmts = restore_user_cmts(cfunc->entry_ea);
226226
if(cmts == NULL)
@@ -337,7 +337,7 @@ cexpr_t* lit_visitor_t::makeEnumExpr(const char* name, uint64 val, cexpr_t *cons
337337
#if IDA_SDK_VERSION < 850
338338
const_t memb = get_enum_member_by_name(name);
339339
if(memb == BADNODE) {
340-
if(!importEnumFromTils(name, val))
340+
if(!importEnumFromTils(name, val))
341341
return NULL;
342342
memb = get_enum_member_by_name(name);
343343
if(memb == BADNODE)
@@ -425,7 +425,7 @@ bool lit_visitor_t::chkCallArg(cexpr_t *expr, qstring &comment)
425425
lit_func_t lfunc = lit->find_func(funcname.c_str());
426426
if(!lit->is_func(lfunc)) {
427427
char lastChar = funcname.last();
428-
if(lastChar != 'A' && lastChar != 'W')
428+
if(lastChar != 'A' && lastChar != 'W')
429429
return false;
430430
funcname.remove_last();
431431
lfunc = lit->find_func(funcname.c_str());
@@ -469,7 +469,7 @@ bool lit_visitor_t::chkStrucMemb(cexpr_t *memb, cexpr_t *cons, qstring &comment)
469469
return false;
470470

471471
// remove first underlining from struct typename
472-
if (typeName[0] == '_')
472+
if (typeName[0] == '_')
473473
typeName.remove(0, 1);
474474

475475
lit_struct_t ls = lit->find_struct(typeName.c_str());
@@ -479,7 +479,7 @@ bool lit_visitor_t::chkStrucMemb(cexpr_t *memb, cexpr_t *cons, qstring &comment)
479479
return false;
480480
typeName.remove_last();
481481
ls = lit->find_struct(typeName.c_str());
482-
if (!lit->is_struct(ls))
482+
if (!lit->is_struct(ls))
483483
return false;
484484
}
485485

@@ -550,7 +550,7 @@ bool lit_visitor_t::chkConstType(cexpr_t *expr, cexpr_t *cons, qstring &comment)
550550
newExp->type = expr->type;
551551
replaceExp(func, expr, newExp);
552552
return true;
553-
}
553+
}
554554
return false;
555555
} else {
556556
//TODO: add more typenames here
@@ -583,7 +583,7 @@ int idaapi lit_visitor_t::visit_expr(cexpr_t *expr)
583583
cexpr_t *memb = expr->theother(cons);
584584
if(memb->op == cot_memref || memb->op == cot_memptr)
585585
changed |= chkStrucMemb(memb, cons, comment);
586-
else
586+
else
587587
changed |= chkConstType(expr, cons, comment);
588588
}
589589
} else if (expr->op == cot_cast && expr->x->op == cot_num) {
@@ -652,7 +652,7 @@ bool lit_overrideTypes()
652652
void lit_init()
653653
{
654654
char litfname[QMAXPATH];
655-
if(getsysfile(litfname, QMAXPATH, "literal.txt", PLG_SUBDIR)) {
655+
if(getPluginsFile(litfname, QMAXPATH, "literal.txt")) {
656656
linput_t *litfile = open_linput(litfname, false);
657657
if (litfile) {
658658
lit = new literal_db();

src/warn_off.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
#pragma GCC diagnostic ignored "-Wswitch"
77
#pragma GCC diagnostic ignored "-Wpedantic"
88
#pragma GCC diagnostic ignored "-Wvarargs"
9+
#pragma GCC diagnostic push
910
#ifdef __MAC__
1011
#pragma GCC diagnostic ignored "-Wnullability-completeness"
12+
#pragma clang diagnostic ignored "-Wnontrivial-memaccess"
1113
#endif // __MAC__
12-
#pragma GCC diagnostic push
1314

1415
//temporary fix for gcc 13.1.1 and IDA81
1516
#include <cstdint>

0 commit comments

Comments
 (0)