cmd: Fixed a number of buffer overflows.

This commit is contained in:
Diaa Sami 2009-03-02 20:45:50 +02:00 committed by Alexandre Julliard
parent 1ad19cc9ce
commit 8ea1a12ed6
17 changed files with 28 additions and 10 deletions

View File

@ -276,4 +276,5 @@ Zadejte HELP <p
WCMD_CONSTITLE,"Wine Command Prompt"
WCMD_VERSION,"CMD Version %s\n\n"
WCMD_MOREPROMPT, "More? "
WCMD_LINETOOLONG, "The input line is too long.\n"
}

View File

@ -254,4 +254,5 @@ Skriv
WCMD_CONSTITLE,"Wine Command Prompt"
WCMD_VERSION,"CMD Version %s\n\n"
WCMD_MOREPROMPT, "Mere? "
WCMD_LINETOOLONG, "The input line is too long.\n"
}

View File

@ -292,4 +292,5 @@ obigen Befehle erhalten.\n"
WCMD_CONSTITLE,"Wine Befehlsprozessor"
WCMD_VERSION,"CMD Version %s\n\n"
WCMD_MOREPROMPT, "Mehr? "
WCMD_LINETOOLONG, "The input line is too long.\n"
}

View File

@ -272,4 +272,5 @@ Enter HELP <command> for further information on any of the above commands\n"
WCMD_CONSTITLE,"Wine Command Prompt"
WCMD_VERSION,"CMD Version %s\n\n"
WCMD_MOREPROMPT, "More? "
WCMD_LINETOOLONG, "The input line is too long.\n"
}

View File

@ -289,4 +289,5 @@ Introduzca HELP <comando> para m
WCMD_CONSTITLE,"Wine Command Prompt"
WCMD_VERSION,"CMD Version %s\n\n"
WCMD_MOREPROMPT, "More? "
WCMD_LINETOOLONG, "The input line is too long.\n"
}

View File

@ -270,4 +270,5 @@ Entrez HELP <commande> pour plus d'informations sur les commandes ci-dessus\n"
WCMD_CONSTITLE,"Invite de commande Wine"
WCMD_VERSION,"CMD version %s\n\n"
WCMD_MOREPROMPT, "Plus ? "
WCMD_LINETOOLONG, "The input line is too long.\n"
}

View File

@ -277,6 +277,7 @@ EXIT\t\tCMDを終了\n\n\
WCMD_CONSTITLE,"Wine Command Prompt"
WCMD_VERSION,"CMD Version %s\n\n"
WCMD_MOREPROMPT, "More? "
WCMD_LINETOOLONG, "The input line is too long.\n"
}
#pragma code_page(default)

View File

@ -264,4 +264,5 @@ HELP <
WCMD_CONSTITLE,"Wine 명령 입력대기"
WCMD_VERSION,"CMD 버젼 %s\n\n"
WCMD_MOREPROMPT, " 더? "
WCMD_LINETOOLONG, "The input line is too long.\n"
}

View File

@ -272,4 +272,5 @@ type HELP <opdracht> voor meer informatie over bovengenoemde opdrachten\n"
WCMD_CONSTITLE,"Wine Command Prompt"
WCMD_VERSION,"CMD Versie %s\n\n"
WCMD_MOREPROMPT, "Meer? "
WCMD_LINETOOLONG, "The input line is too long.\n"
}

View File

@ -270,4 +270,5 @@ Skriv
WCMD_CONSTITLE,"Wine Command Prompt"
WCMD_VERSION,"CMD Version %s\n\n"
WCMD_MOREPROMPT, "More? "
WCMD_LINETOOLONG, "The input line is too long.\n"
}

View File

@ -267,4 +267,5 @@ Wpisz HELP <komenda> dla dok
WCMD_CONSTITLE,"Wine Command Prompt"
WCMD_VERSION,"CMD Version %s\n\n"
WCMD_MOREPROMPT, "More? "
WCMD_LINETOOLONG, "The input line is too long.\n"
}

View File

@ -499,4 +499,5 @@ Digite HELP <comando> para mais informa
WCMD_CONSTITLE,"Wine Command Prompt"
WCMD_VERSION,"CMD Version %s\n\n"
WCMD_MOREPROMPT, "More? "
WCMD_LINETOOLONG, "The input line is too long.\n"
}

View File

@ -278,4 +278,5 @@ EXIT\t\t
WCMD_CONSTITLE,"Приглашение командной строки Wine"
WCMD_VERSION,"Версия CMD %s\n\n"
WCMD_MOREPROMPT, "Ещё? "
WCMD_LINETOOLONG, "The input line is too long.\n"
}

View File

@ -270,6 +270,7 @@ Uporabite HELP <ukaz> za več informacijo o kateremkoli od zgoraj navedenih ukaz
WCMD_CONSTITLE,"Wine ukazni poziv"
WCMD_VERSION,"CMD različica %s\n\n"
WCMD_MOREPROMPT, "Več? "
WCMD_LINETOOLONG, "The input line is too long.\n"
}
#pragma code_page(default)

View File

@ -274,4 +274,5 @@ Yukar
WCMD_CONSTITLE,"Wine Command Prompt"
WCMD_VERSION,"CMD Version %s\n\n"
WCMD_MOREPROMPT, "More? "
WCMD_LINETOOLONG, "The input line is too long.\n"
}

View File

@ -243,6 +243,7 @@ extern WCHAR version_string[];
#define WCMD_CONSTITLE 1032
#define WCMD_VERSION 1033
#define WCMD_MOREPROMPT 1034
#define WCMD_LINETOOLONG 1035
/* msdn specified max for Win XP */
#define MAXSTRING 8192

View File

@ -88,7 +88,7 @@ static const WCHAR equalsW[] = {'=','\0'};
static const WCHAR closeBW[] = {')','\0'};
WCHAR anykey[100];
WCHAR version_string[100];
WCHAR quals[MAX_PATH], param1[MAX_PATH], param2[MAX_PATH];
WCHAR quals[MAX_PATH], param1[MAXSTRING], param2[MAXSTRING];
BATCH_CONTEXT *context = NULL;
extern struct env_stack *pushd_directories;
static const WCHAR *pagedMessage = NULL;
@ -972,7 +972,8 @@ void WCMD_run_program (WCHAR *command, int called) {
WCHAR temp[MAX_PATH];
WCHAR pathtosearch[MAXSTRING];
WCHAR *pathposn;
WCHAR stemofsearch[MAX_PATH];
WCHAR stemofsearch[MAX_PATH]; /* maximum allowed executable name is
MAX_PATH, including null character */
WCHAR *lastSlash;
WCHAR pathext[MAXSTRING];
BOOL extensionsupplied = FALSE;
@ -998,6 +999,12 @@ void WCMD_run_program (WCHAR *command, int called) {
strcpyW (pathtosearch, curDir);
}
if (strchrW(param1, '.') != NULL) extensionsupplied = TRUE;
if (strlenW(param1) >= MAX_PATH)
{
WCMD_output_asis(WCMD_LoadMessage(WCMD_LINETOOLONG));
return;
}
strcpyW(stemofsearch, param1);
} else {
@ -1584,22 +1591,17 @@ WCHAR *WCMD_LoadMessage(UINT id) {
* Dumps out the parsed command line to ensure syntax is correct
*/
static void WCMD_DumpCommands(CMD_LIST *commands) {
WCHAR buffer[MAXSTRING];
CMD_LIST *thisCmd = commands;
const WCHAR fmt[] = {'%','p',' ','%','d',' ','%','2','.','2','d',' ',
'%','p',' ','%','s',' ','R','e','d','i','r',':',
'%','s','\0'};
WINE_TRACE("Parsed line:\n");
while (thisCmd != NULL) {
sprintfW(buffer, fmt,
WINE_TRACE("%p %d %2.2d %p %s Redir:%s\n",
thisCmd,
thisCmd->prevDelim,
thisCmd->bracketDepth,
thisCmd->nextcommand,
thisCmd->command,
thisCmd->redirects);
WINE_TRACE("%s\n", wine_dbgstr_w(buffer));
wine_dbgstr_w(thisCmd->command),
wine_dbgstr_w(thisCmd->redirects));
thisCmd = thisCmd->nextcommand;
}
}