kernel32/tests: Fix some format-overflow warnings.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2020-02-11 19:09:26 +01:00 committed by Alexandre Julliard
parent cc012d13ee
commit c2b81e8dfd
4 changed files with 32 additions and 32 deletions

View File

@ -3207,9 +3207,9 @@ static void test_settings(void)
typedef struct typedef struct
{ {
char path_tmp[MAX_PATH]; char path_tmp[MAX_PATH];
char path_dll[MAX_PATH]; char path_dll[MAX_PATH + 11];
char path_manifest_exe[MAX_PATH]; char path_manifest_exe[MAX_PATH + 12];
char path_manifest_dll[MAX_PATH]; char path_manifest_dll[MAX_PATH + 16];
ACTCTXA context; ACTCTXA context;
ULONG_PTR cookie; ULONG_PTR cookie;
HANDLE handle_context; HANDLE handle_context;
@ -3332,7 +3332,7 @@ cleanup1:
static void test_one_sxs_and_one_local_1(void) static void test_one_sxs_and_one_local_1(void)
{ {
sxs_info dll; sxs_info dll;
char path_dll_local[MAX_PATH]; char path_dll_local[MAX_PATH + 11];
char path_application[MAX_PATH]; char path_application[MAX_PATH];
HMODULE module = NULL; HMODULE module = NULL;
char path1[MAX_PATH], path2[MAX_PATH]; char path1[MAX_PATH], path2[MAX_PATH];
@ -3372,7 +3372,7 @@ cleanup:
static void test_one_sxs_and_one_local_2(void) static void test_one_sxs_and_one_local_2(void)
{ {
sxs_info dll; sxs_info dll;
char path_dll_local[MAX_PATH]; char path_dll_local[MAX_PATH + 11];
char path_application[MAX_PATH]; char path_application[MAX_PATH];
HMODULE module = NULL; HMODULE module = NULL;
char path1[MAX_PATH], path2[MAX_PATH]; char path1[MAX_PATH], path2[MAX_PATH];
@ -3413,7 +3413,7 @@ cleanup:
static void test_one_with_sxs_and_GetModuleHandleA(void) static void test_one_with_sxs_and_GetModuleHandleA(void)
{ {
sxs_info dll; sxs_info dll;
char path_dll_local[MAX_PATH]; char path_dll_local[MAX_PATH + 11];
char path_tmp[MAX_PATH]; char path_tmp[MAX_PATH];
HMODULE module = NULL, module_temp; HMODULE module = NULL, module_temp;
BOOL success; BOOL success;
@ -3451,7 +3451,7 @@ cleanup:
static void test_builtin_sxs(void) static void test_builtin_sxs(void)
{ {
char path_manifest[MAX_PATH]; char path_manifest[MAX_PATH + 12];
char path_tmp[MAX_PATH]; char path_tmp[MAX_PATH];
HMODULE module_msvcp = 0, module_msvcr = 0; HMODULE module_msvcp = 0, module_msvcr = 0;
char path_msvcp[MAX_PATH], path_msvcr[MAX_PATH]; char path_msvcp[MAX_PATH], path_msvcr[MAX_PATH];

View File

@ -108,10 +108,10 @@ static void test_ValidPathA(const CHAR *curdir, const CHAR *subdir, const CHAR *
CHAR *shortstr, SLpassfail *passfail, const CHAR *errstr) CHAR *shortstr, SLpassfail *passfail, const CHAR *errstr)
{ {
CHAR tmpstr[MAX_PATH], CHAR tmpstr[MAX_PATH],
fullpath[MAX_PATH], /*full path to the file (not short/long) */ fullpath[MAX_PATH + 1], /*full path to the file (not short/long) */
subpath[MAX_PATH], /*relative path to the file */ subpath[MAX_PATH], /*relative path to the file */
fullpathshort[MAX_PATH], /*absolute path to the file (short format) */ fullpathshort[2 * MAX_PATH], /*absolute path to the file (short format) */
fullpathlong[MAX_PATH], /*absolute path to the file (long format) */ fullpathlong[2 * MAX_PATH], /*absolute path to the file (long format) */
curdirshort[MAX_PATH], /*absolute path to the current dir (short) */ curdirshort[MAX_PATH], /*absolute path to the current dir (short) */
curdirlong[MAX_PATH]; /*absolute path to the current dir (long) */ curdirlong[MAX_PATH]; /*absolute path to the current dir (long) */
LPSTR strptr; /*ptr to the filename portion of the path */ LPSTR strptr; /*ptr to the filename portion of the path */
@ -333,7 +333,7 @@ static void test_InitPathA(CHAR *newdir, CHAR *curDrive, CHAR *otherDrive)
CHAR tmppath[MAX_PATH], /*path to TEMP */ CHAR tmppath[MAX_PATH], /*path to TEMP */
tmpstr[MAX_PATH], tmpstr[MAX_PATH],
tmpstr1[MAX_PATH], tmpstr1[MAX_PATH],
invalid_dir[MAX_PATH]; invalid_dir[MAX_PATH + 29];
DWORD len,len1,drives; DWORD len,len1,drives;
INT id; INT id;
@ -557,7 +557,7 @@ static void test_CurrentDirectoryA(CHAR *origdir, CHAR *newdir)
/* Cleanup the mess we made while executing these tests */ /* Cleanup the mess we made while executing these tests */
static void test_CleanupPathA(CHAR *origdir, CHAR *curdir) static void test_CleanupPathA(CHAR *origdir, CHAR *curdir)
{ {
CHAR tmpstr[MAX_PATH]; CHAR tmpstr[MAX_PATH + 35];
sprintf(tmpstr,"%s\\%s\\%s",curdir,SHORTDIR,SHORTFILE); sprintf(tmpstr,"%s\\%s\\%s",curdir,SHORTDIR,SHORTFILE);
ok(DeleteFileA(tmpstr),"DeleteFileA failed\n"); ok(DeleteFileA(tmpstr),"DeleteFileA failed\n");
sprintf(tmpstr,"%s\\%s\\%s",curdir,SHORTDIR,LONGFILE); sprintf(tmpstr,"%s\\%s\\%s",curdir,SHORTDIR,LONGFILE);
@ -602,7 +602,7 @@ static void test_PathNameA(CHAR *curdir, CHAR curDrive, CHAR otherDrive)
{ {
CHAR curdir_short[MAX_PATH], CHAR curdir_short[MAX_PATH],
longdir_short[MAX_PATH]; longdir_short[MAX_PATH];
CHAR tmpstr[MAX_PATH],tmpstr1[MAX_PATH],tmpstr2[MAX_PATH]; CHAR tmpstr[MAX_PATH + 15],tmpstr1[MAX_PATH + 22],tmpstr2[2 * MAX_PATH + 15];
LPSTR strptr; /*ptr to the filename portion of the path */ LPSTR strptr; /*ptr to the filename portion of the path */
DWORD len; DWORD len;
INT i; INT i;
@ -1780,7 +1780,7 @@ static void test_SearchPathA(void)
static const CHAR testdeprelA[] = "./testdep.dll"; static const CHAR testdeprelA[] = "./testdep.dll";
static const CHAR kernel32A[] = "kernel32.dll"; static const CHAR kernel32A[] = "kernel32.dll";
static const CHAR fileA[] = ""; static const CHAR fileA[] = "";
CHAR pathA[MAX_PATH], buffA[MAX_PATH], path2A[MAX_PATH], path3A[MAX_PATH], curdirA[MAX_PATH]; CHAR pathA[MAX_PATH + 13], buffA[MAX_PATH], path2A[MAX_PATH], path3A[MAX_PATH + 13], curdirA[MAX_PATH];
CHAR tmpdirA[MAX_PATH], *ptrA = NULL; CHAR tmpdirA[MAX_PATH], *ptrA = NULL;
ULONG_PTR cookie; ULONG_PTR cookie;
HANDLE handle; HANDLE handle;

View File

@ -598,7 +598,7 @@ static void ok_child_int( int line, const char *sect, const char *key, UINT expe
static void test_Startup(void) static void test_Startup(void)
{ {
char buffer[MAX_PATH]; char buffer[2 * MAX_PATH + 25];
PROCESS_INFORMATION info; PROCESS_INFORMATION info;
STARTUPINFOA startup,si; STARTUPINFOA startup,si;
char *result; char *result;
@ -884,8 +884,8 @@ static void test_Startup(void)
static void test_CommandLine(void) static void test_CommandLine(void)
{ {
char buffer[MAX_PATH], fullpath[MAX_PATH], *lpFilePart, *p; char buffer[2 * MAX_PATH + 65], fullpath[MAX_PATH], *lpFilePart, *p;
char buffer2[MAX_PATH]; char buffer2[MAX_PATH + 44];
PROCESS_INFORMATION info; PROCESS_INFORMATION info;
STARTUPINFOA startup; STARTUPINFOA startup;
BOOL ret; BOOL ret;
@ -1093,7 +1093,7 @@ static void test_CommandLine(void)
static void test_Directory(void) static void test_Directory(void)
{ {
char buffer[MAX_PATH]; char buffer[2 * MAX_PATH + 25];
PROCESS_INFORMATION info; PROCESS_INFORMATION info;
STARTUPINFOA startup; STARTUPINFOA startup;
char windir[MAX_PATH]; char windir[MAX_PATH];
@ -1137,7 +1137,7 @@ static void test_Directory(void)
static void test_Toolhelp(void) static void test_Toolhelp(void)
{ {
char buffer[MAX_PATH]; char buffer[2 * MAX_PATH + 27];
STARTUPINFOA startup; STARTUPINFOA startup;
PROCESS_INFORMATION info; PROCESS_INFORMATION info;
HANDLE process, thread, snapshot; HANDLE process, thread, snapshot;
@ -1306,7 +1306,7 @@ static void cmpEnvironment(const char* gesA)
static void test_Environment(void) static void test_Environment(void)
{ {
char buffer[MAX_PATH]; char buffer[2 * MAX_PATH + 25];
PROCESS_INFORMATION info; PROCESS_INFORMATION info;
STARTUPINFOA startup; STARTUPINFOA startup;
char *child_env; char *child_env;
@ -1397,7 +1397,7 @@ static void test_Environment(void)
static void test_SuspendFlag(void) static void test_SuspendFlag(void)
{ {
char buffer[MAX_PATH]; char buffer[2 * MAX_PATH + 25];
PROCESS_INFORMATION info; PROCESS_INFORMATION info;
STARTUPINFOA startup, us; STARTUPINFOA startup, us;
DWORD exit_status; DWORD exit_status;
@ -1445,7 +1445,7 @@ static void test_SuspendFlag(void)
static void test_DebuggingFlag(void) static void test_DebuggingFlag(void)
{ {
char buffer[MAX_PATH]; char buffer[2 * MAX_PATH + 25];
void *processbase = NULL; void *processbase = NULL;
PROCESS_INFORMATION info; PROCESS_INFORMATION info;
STARTUPINFOA startup, us; STARTUPINFOA startup, us;
@ -1512,7 +1512,7 @@ static BOOL is_console(HANDLE h)
static void test_Console(void) static void test_Console(void)
{ {
char buffer[MAX_PATH]; char buffer[2 * MAX_PATH + 35];
PROCESS_INFORMATION info; PROCESS_INFORMATION info;
STARTUPINFOA startup, us; STARTUPINFOA startup, us;
SECURITY_ATTRIBUTES sa; SECURITY_ATTRIBUTES sa;
@ -1700,7 +1700,7 @@ static void test_Console(void)
static void test_ExitCode(void) static void test_ExitCode(void)
{ {
char buffer[MAX_PATH]; char buffer[2 * MAX_PATH + 35];
PROCESS_INFORMATION info; PROCESS_INFORMATION info;
STARTUPINFOA startup; STARTUPINFOA startup;
DWORD code; DWORD code;
@ -2415,7 +2415,7 @@ static void _test_completion(int line, HANDLE port, DWORD ekey, ULONG_PTR evalue
static void _create_process(int line, const char *command, LPPROCESS_INFORMATION pi) static void _create_process(int line, const char *command, LPPROCESS_INFORMATION pi)
{ {
BOOL ret; BOOL ret;
char buffer[MAX_PATH]; char buffer[MAX_PATH + 19];
STARTUPINFOA si = {0}; STARTUPINFOA si = {0};
sprintf(buffer, "\"%s\" tests/process.c %s", selfname, command); sprintf(buffer, "\"%s\" tests/process.c %s", selfname, command);
@ -2830,7 +2830,7 @@ static HANDLE test_AddSelfToJob(void)
static void test_jobInheritance(HANDLE job) static void test_jobInheritance(HANDLE job)
{ {
char buffer[MAX_PATH]; char buffer[MAX_PATH + 23];
PROCESS_INFORMATION pi; PROCESS_INFORMATION pi;
STARTUPINFOA si = {0}; STARTUPINFOA si = {0};
DWORD dwret; DWORD dwret;
@ -2864,7 +2864,7 @@ static void test_BreakawayOk(HANDLE job)
JOBOBJECT_EXTENDED_LIMIT_INFORMATION limit_info; JOBOBJECT_EXTENDED_LIMIT_INFORMATION limit_info;
PROCESS_INFORMATION pi; PROCESS_INFORMATION pi;
STARTUPINFOA si = {0}; STARTUPINFOA si = {0};
char buffer[MAX_PATH]; char buffer[MAX_PATH + 23];
BOOL ret, out; BOOL ret, out;
DWORD dwret; DWORD dwret;
@ -2934,7 +2934,7 @@ static void test_BreakawayOk(HANDLE job)
static void test_StartupNoConsole(void) static void test_StartupNoConsole(void)
{ {
#ifndef _WIN64 #ifndef _WIN64
char buffer[MAX_PATH]; char buffer[2 * MAX_PATH + 25];
STARTUPINFOA startup; STARTUPINFOA startup;
PROCESS_INFORMATION info; PROCESS_INFORMATION info;
@ -2962,7 +2962,7 @@ static void test_StartupNoConsole(void)
static void test_DetachConsoleHandles(void) static void test_DetachConsoleHandles(void)
{ {
#ifndef _WIN64 #ifndef _WIN64
char buffer[MAX_PATH]; char buffer[2 * MAX_PATH + 25];
STARTUPINFOA startup; STARTUPINFOA startup;
PROCESS_INFORMATION info; PROCESS_INFORMATION info;
UINT result; UINT result;
@ -3385,7 +3385,7 @@ static void test_SuspendProcessState(void)
static void test_DetachStdHandles(void) static void test_DetachStdHandles(void)
{ {
#ifndef _WIN64 #ifndef _WIN64
char buffer[MAX_PATH], tempfile[MAX_PATH]; char buffer[2 * MAX_PATH + 25], tempfile[MAX_PATH];
STARTUPINFOA startup; STARTUPINFOA startup;
PROCESS_INFORMATION info; PROCESS_INFORMATION info;
HANDLE hstdin, hstdout, hstderr, htemp; HANDLE hstdin, hstdout, hstderr, htemp;
@ -4034,7 +4034,7 @@ START_TEST(process)
} }
else if (!strcmp(myARGV[2], "nested") && myARGC >= 4) else if (!strcmp(myARGV[2], "nested") && myARGC >= 4)
{ {
char buffer[MAX_PATH]; char buffer[MAX_PATH + 26];
STARTUPINFOA startup; STARTUPINFOA startup;
PROCESS_INFORMATION info; PROCESS_INFORMATION info;

View File

@ -284,7 +284,7 @@ START_TEST(toolhelp)
DWORD pid = GetCurrentProcessId(); DWORD pid = GetCurrentProcessId();
int r; int r;
char *p, module[MAX_PATH]; char *p, module[MAX_PATH];
char buffer[MAX_PATH]; char buffer[MAX_PATH + 21];
SECURITY_ATTRIBUTES sa; SECURITY_ATTRIBUTES sa;
PROCESS_INFORMATION info; PROCESS_INFORMATION info;
STARTUPINFOA startup; STARTUPINFOA startup;