From 4f5ad4b3acbdf2ce29c68ad0c8a6dd908175ea20 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Fri, 26 Mar 2021 08:56:12 +0100 Subject: Added wrapped __swprintf_chk function --- src/wrapped/wrappedlibc.c | 17 +++++------------ src/wrapped/wrappedlibc_private.h | 2 +- 2 files changed, 6 insertions(+), 13 deletions(-) (limited to 'src/wrapped') diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c index 3ba746c1..15e5204c 100755 --- a/src/wrapped/wrappedlibc.c +++ b/src/wrapped/wrappedlibc.c @@ -857,21 +857,14 @@ EXPORT void my_vwarn(x64emu_t* emu, void* fmt, void* b) { ((vFpp_t)f)(fmt, (uint32_t*)b); #endif } - -EXPORT int my___swprintf_chk(x64emu_t* emu, void* s, uint32_t n, int32_t flag, uint32_t slen, void* fmt, void * b) +#endif +EXPORT int my___swprintf_chk(x64emu_t* emu, void* s, size_t n, int32_t flag, size_t slen, void* fmt, uint64_t* b) { - #ifndef NOALIGN - myStackAlignW((const char*)fmt, b, emu->scratch); + myStackAlign(emu, (const char*)fmt, b, emu->scratch, R_EAX, 5); PREPARE_VALIST; - void* f = vswprintf; - int r = ((iFpupp_t)f)(s, n, fmt, VARARGS); - return r; - #else - void* f = vswprintf; - int r = ((iFpupp_t)f)(s, n, fmt, b); - return r; - #endif + return vswprintf(s, n, (const wchar_t*)fmt, VARARGS); } +#if 0 EXPORT int my_swprintf(x64emu_t* emu, void* s, uint32_t n, void* fmt, void *b) { #ifndef NOALIGN diff --git a/src/wrapped/wrappedlibc_private.h b/src/wrapped/wrappedlibc_private.h index a5f44108..9e8f9a8e 100755 --- a/src/wrapped/wrappedlibc_private.h +++ b/src/wrapped/wrappedlibc_private.h @@ -1907,7 +1907,7 @@ GOM(swapcontext, iFEpp) //Weak //GOW(swapoff, //GOW(swapon, //GO(swprintf, -//GO(__swprintf_chk, +GOM(__swprintf_chk, iFEpLiLpV) //GO(swscanf, //GOW(symlink, //GO(symlinkat, -- cgit 1.4.1