mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-21 05:05:48 +00:00
Some fixes (#12670)
This commit is contained in:
parent
1f0f27ed1b
commit
b2c7f7ef6c
@ -361,7 +361,7 @@ static int cmd_cmp_disasm(RCore *core, const char *input, int mode) {
|
||||
r_cons_printf (iseq? Color_GREEN: Color_RED);
|
||||
}
|
||||
r_cons_printf (" 0x%08"PFMT64x " %s %s",
|
||||
core->offset + i, op.buf_asm, colpad);
|
||||
core->offset + i, r_strbuf_get (&op.buf_asm), colpad);
|
||||
r_cons_printf ("%c 0x%08"PFMT64x " %s\n",
|
||||
iseq? '=': '!', off + j, r_strbuf_get (&op2.buf_asm));
|
||||
if (hascolor) {
|
||||
@ -393,18 +393,18 @@ static int cmd_cmp_disasm(RCore *core, const char *input, int mode) {
|
||||
bool iseq = r_strbuf_equals (&op.buf_asm, &op2.buf_asm); // (!strcmp (op.buf_asm, op2.buf_asm));
|
||||
if (iseq) {
|
||||
r_cons_printf (" 0x%08"PFMT64x " %s\n",
|
||||
core->offset + i, op.buf_asm);
|
||||
core->offset + i, r_strbuf_get (&op.buf_asm));
|
||||
} else {
|
||||
if (hascolor) {
|
||||
r_cons_printf (Color_RED);
|
||||
}
|
||||
r_cons_printf ("-0x%08"PFMT64x " %s\n",
|
||||
core->offset + i, op.buf_asm);
|
||||
core->offset + i, r_strbuf_get (&op.buf_asm));
|
||||
if (hascolor) {
|
||||
r_cons_printf (Color_GREEN);
|
||||
}
|
||||
r_cons_printf ("+0x%08"PFMT64x " %s\n",
|
||||
off + j, op2.buf_asm);
|
||||
off + j, r_strbuf_get (&op2.buf_asm));
|
||||
if (hascolor) {
|
||||
r_cons_printf (Color_RESET);
|
||||
}
|
||||
|
@ -5092,7 +5092,7 @@ static int cmd_print(void *data, const char *input) {
|
||||
r_cons_printf ("%s0x%02x", j? ", ": "", buf[i]);
|
||||
i++;
|
||||
}
|
||||
r_cons_printf (" // %s\n", asmop.buf_asm);
|
||||
r_cons_printf (" // %s\n", r_strbuf_get (&asmop.buf_asm));
|
||||
i--;
|
||||
}
|
||||
r_cons_printf (".equ shellcode_len, %d\n", len);
|
||||
|
@ -61,7 +61,7 @@ static RList *fs_posix_dir(RFSRoot *root, const char *path, int view /*ignored*/
|
||||
if (!wcpath) {
|
||||
return NULL;
|
||||
}
|
||||
swprintf (directory, sizeof (directory), L"%ls\\*.*", wcpath);
|
||||
swprintf (directory, _countof (directory), L"%ls\\*.*", wcpath);
|
||||
fh = FindFirstFileW (directory, &entry);
|
||||
if (fh == INVALID_HANDLE_VALUE) {
|
||||
free (wcpath);
|
||||
|
@ -39,6 +39,7 @@ static int lang_zig_file(RLang *lang, const char *file) {
|
||||
if (r_sandbox_system (cmd, 1) != 0) {
|
||||
free (name);
|
||||
free (cmd);
|
||||
free (cc);
|
||||
return false;
|
||||
}
|
||||
free (cmd);
|
||||
|
@ -569,7 +569,7 @@ static int apprentice_load(RMagic *ms, struct r_magic **magicp, ut32 *nmagicp, c
|
||||
}
|
||||
#if __WINDOWS__ && !defined(__CYGWIN__)
|
||||
if ((wcpath = r_utf8_to_utf16 (fn))) {
|
||||
swprintf (dir, sizeof (dir), L"%ls\\*.*", wcpath);
|
||||
swprintf (dir, _countof (dir), L"%ls\\*.*", wcpath);
|
||||
hdir = FindFirstFileW (dir, &entry);
|
||||
if (!(hdir == INVALID_HANDLE_VALUE)) {
|
||||
do {
|
||||
|
@ -365,7 +365,7 @@ R_API int r_lib_opendir(RLib *lib, const char *path) {
|
||||
#if __MINGW32__
|
||||
swprintf (directory, L"%ls\\*.*", wcpath);
|
||||
#else
|
||||
swprintf (directory, sizeof (directory), L"%ls\\*.*", wcpath);
|
||||
swprintf (directory, _countof (directory), L"%ls\\*.*", wcpath);
|
||||
#endif
|
||||
fh = FindFirstFileW (directory, &dir);
|
||||
if (fh == INVALID_HANDLE_VALUE) {
|
||||
@ -377,7 +377,7 @@ R_API int r_lib_opendir(RLib *lib, const char *path) {
|
||||
#if __MINGW32__
|
||||
swprintf (file, L"%ls/%ls", wcpath, dir.cFileName);
|
||||
#else
|
||||
swprintf (file, sizeof (file), L"%ls/%ls", wcpath, dir.cFileName);
|
||||
swprintf (file, _countof (file), L"%ls/%ls", wcpath, dir.cFileName);
|
||||
#endif
|
||||
wctocbuff = r_utf16_to_utf8 (file);
|
||||
if (wctocbuff) {
|
||||
|
@ -2120,6 +2120,7 @@ R_API char **r_str_argv(const char *cmdline, int *_argc) {
|
||||
argv_len *= 2;
|
||||
char **tmp = realloc (argv, argv_len * sizeof (char *));
|
||||
if (!tmp) {
|
||||
free (args);
|
||||
free (argv);
|
||||
return NULL;
|
||||
}
|
||||
@ -2971,7 +2972,7 @@ R_API char *r_str_between(const char *cmt, const char *prefix, const char *suffi
|
||||
c0 = strstr (cmt, prefix);
|
||||
if (c0) {
|
||||
c1 = strstr (c0 + strlen (prefix), suffix);
|
||||
if (!c1) {
|
||||
if (c1) {
|
||||
return r_str_ndup (c0 + strlen (prefix), (c1 - c0 - strlen (prefix)));
|
||||
}
|
||||
}
|
||||
|
@ -406,7 +406,7 @@ R_API int r_sys_crash_handler(const char *cmd) {
|
||||
R_API char *r_sys_getenv(const char *key) {
|
||||
#if __WINDOWS__ && !__CYGWIN__
|
||||
DWORD dwRet;
|
||||
LPTSTR envbuf = NULL, key_ = NULL;
|
||||
LPTSTR envbuf = NULL, key_ = NULL, tmp_ptr;
|
||||
char *val = NULL;
|
||||
|
||||
if (!key) {
|
||||
@ -423,10 +423,11 @@ R_API char *r_sys_getenv(const char *key) {
|
||||
goto err_r_sys_get_env;
|
||||
}
|
||||
} else if (TMP_BUFSIZE < dwRet) {
|
||||
envbuf = (LPTSTR)realloc (envbuf, dwRet * sizeof (TCHAR));
|
||||
if (!envbuf) {
|
||||
tmp_ptr = (LPTSTR)realloc (envbuf, dwRet * sizeof (TCHAR));
|
||||
if (!tmp_ptr) {
|
||||
goto err_r_sys_get_env;
|
||||
}
|
||||
envbuf = tmp_ptr;
|
||||
dwRet = GetEnvironmentVariable (key_, envbuf, dwRet);
|
||||
if (!dwRet) {
|
||||
goto err_r_sys_get_env;
|
||||
|
@ -27,6 +27,7 @@ R_API ut8 *r_inflate(const ut8 *src, int srcLen, int *srcConsumed, int *dstLen)
|
||||
int err = 0;
|
||||
int out_size = 0;
|
||||
ut8 *dst = NULL;
|
||||
ut8 *tmp_ptr;
|
||||
z_stream stream;
|
||||
|
||||
if (srcLen <= 0) {
|
||||
@ -48,9 +49,11 @@ R_API ut8 *r_inflate(const ut8 *src, int srcLen, int *srcConsumed, int *dstLen)
|
||||
|
||||
do {
|
||||
if (stream.avail_out == 0) {
|
||||
if (!(dst = realloc (dst, stream.total_out + srcLen * 2))) {
|
||||
tmp_ptr = realloc (dst, stream.total_out + srcLen * 2);
|
||||
if (!tmp_ptr) {
|
||||
goto err_exit;
|
||||
}
|
||||
dst = tmp_ptr;
|
||||
out_size += srcLen*2;
|
||||
if (out_size > MAXOUT) {
|
||||
goto err_exit;
|
||||
|
Loading…
x
Reference in New Issue
Block a user