Skip to content

Commit db6edf3

Browse files
committed
Fix format strings bug found by @shuffle2
We don't need PRIea_t, since IDA already provides %a
1 parent 2234371 commit db6edf3

6 files changed

Lines changed: 10 additions & 17 deletions

File tree

backup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ static size_t singleton_unserialize(char * buf, size_t blen, psig_t ** s, int ve
267267
buffer_unserialize_string(buf, blen, &pos, &(*s)->name);
268268
else
269269
{
270-
qsnprintf(tmp, sizeof(tmp), "sub_%" PRIea_t, (*s)->startEA);
270+
qsnprintf(tmp, sizeof(tmp), "sub_%a", (*s)->startEA);
271271
sig_set_name((*s), tmp);
272272
}
273273
}

display.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ static void idaapi desc_dlist(slist_t * sl,uint32 n,char * const *arrptr)
107107
qsnprintf(arrptr[0], MAXSTR, "%u", sig->mtype);
108108
qsnprintf(arrptr[1], MAXSTR, "%s", sig->name);
109109
qsnprintf(arrptr[2], MAXSTR, "%s", sig->msig->name);
110-
qsnprintf(arrptr[3], MAXSTR, "%" PRIea_t, sig->startEA);
111-
qsnprintf(arrptr[4], MAXSTR, "%" PRIea_t, sig->msig->startEA);
110+
qsnprintf(arrptr[3], MAXSTR, "%a", sig->startEA);
111+
qsnprintf(arrptr[4], MAXSTR, "%a", sig->msig->startEA);
112112
qsnprintf(arrptr[5], MAXSTR, "%c", sig->id_crc ? '+' : '-');
113113
qsnprintf(arrptr[6], MAXSTR, "%lx", sig->crc_hash);
114114
qsnprintf(arrptr[7], MAXSTR, "%lx", sig->msig->crc_hash);
@@ -162,7 +162,7 @@ static void idaapi desc_unmatch(void *obj,uint32 n,char * const *arrptr)
162162
psig_t *sig = ui_access_sig(((deng_t *)obj)->ulist, n);
163163
qsnprintf(arrptr[0], MAXSTR, "%u", sig->nfile);
164164
qsnprintf(arrptr[1], MAXSTR, "%s", sig->name);
165-
qsnprintf(arrptr[2], MAXSTR, "%" PRIea_t, sig->startEA);
165+
qsnprintf(arrptr[2], MAXSTR, "%a", sig->startEA);
166166
qsnprintf(arrptr[3], MAXSTR, "%.8lX", sig->sig);
167167
qsnprintf(arrptr[4], MAXSTR, "%.8lX", sig->hash);
168168
qsnprintf(arrptr[5], MAXSTR, "%.8lX", sig->crc_hash);
@@ -486,7 +486,7 @@ static uint32 idaapi res_match(void *obj,uint32 n)
486486
return 1;
487487
}
488488

489-
warning("Address '%" PRIea_t "' is not valid.", ea);
489+
warning("Address '%a' is not valid.", ea);
490490
return 0;
491491
}
492492

patchdiff.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ static void run_second_instance(const char * options)
148148
bool cont;
149149
char tmp[QMAXPATH*4];
150150

151-
qsscanf(options, "%lu:%" PRIea_t ":%u:%s", &id, &ea, &v, file);
151+
qsscanf(options, "%lu:%a:%u:%s", &id, &ea, &v, file);
152152
opt = (unsigned char)v;
153153

154154
if (id)

precomp.hpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,3 @@
4848

4949
static_assert(IDA_SDK_VERSION == 650, "This plugin expects IDA SDK 6.5");
5050

51-
52-
// Define PRIea_t like the PRI family of constants
53-
#ifdef __EA64__
54-
#define PRIea_t "llx"
55-
#else
56-
#define PRIea_t "x"
57-
#endif

sig.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ int dline_add(dline_t * dl, ea_t ea, char options)
538538

539539
if (options)
540540
{
541-
qsnprintf(addr, sizeof(addr), "%" PRIea_t, ea);
541+
qsnprintf(addr, sizeof(addr), "%a", ea);
542542
out_snprintf("%s ", addr);
543543
}
544544

@@ -795,7 +795,7 @@ psig_t * sig_class_generate(ea_t ea)
795795
sig_set_start(sig, ea);
796796

797797
// Adds function name
798-
qsnprintf(buf, sizeof(buf), "sub_%" PRIea_t, ea);
798+
qsnprintf(buf, sizeof(buf), "sub_%a", ea);
799799
sig_set_name(sig, buf);
800800

801801
// Adds class references

system.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ static int system_execute_second_instance(char * idc, ea_t ea, char * file, bool
6666
if (generate_idc_file(idc))
6767
return -1;
6868

69-
qsnprintf(cmd, sizeof(cmd), "\"%s\" -A -S\"%s\" -Opatchdiff2:%ld:%" PRIea_t ":%u:\"%s\" \"%s\"",
69+
qsnprintf(cmd, sizeof(cmd), "\"%s\" -A -S\"%s\" -Opatchdiff2:%ld:%a:%u:\"%s\" \"%s\"",
7070
path,
7171
idc,
7272
id,
@@ -227,7 +227,7 @@ static void ipc_execute_second_instance(char * idc, ea_t ea, char * file)
227227
if (!ipc_init(file, 1, 0))
228228
return;
229229

230-
qsnprintf(cmd, sizeof(cmd), "%u:%" PRIea_t ":%u:%s",
230+
qsnprintf(cmd, sizeof(cmd), "%u:%a:%u:%s",
231231
0,
232232
ea,
233233
dto.graph.s_showpref,

0 commit comments

Comments
 (0)