Commit 8ea1a12e authored by Diaa Sami's avatar Diaa Sami Committed by Alexandre Julliard

cmd: Fixed a number of buffer overflows.

parent 1ad19cc9
......@@ -276,4 +276,5 @@ Zadejte HELP <pkaz> pro podrobnj informace o nkterm z ve uvedench pk
WCMD_CONSTITLE,"Wine Command Prompt"
WCMD_VERSION,"CMD Version %s\n\n"
WCMD_MOREPROMPT, "More? "
WCMD_LINETOOLONG, "The input line is too long.\n"
}
......@@ -254,4 +254,5 @@ Skriv HELP <kommando> for mere information om kommandoerne ovenover\n"
WCMD_CONSTITLE,"Wine Command Prompt"
WCMD_VERSION,"CMD Version %s\n\n"
WCMD_MOREPROMPT, "Mere? "
WCMD_LINETOOLONG, "The input line is too long.\n"
}
......@@ -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"
}
......@@ -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"
}
......@@ -289,4 +289,5 @@ Introduzca HELP <comando> para ms informacin sobre cualquiera de los comandos\
WCMD_CONSTITLE,"Wine Command Prompt"
WCMD_VERSION,"CMD Version %s\n\n"
WCMD_MOREPROMPT, "More? "
WCMD_LINETOOLONG, "The input line is too long.\n"
}
......@@ -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"
}
......@@ -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)
......@@ -264,4 +264,5 @@ HELP <명령>을 치면 그 명령의 상세한 정보를 보여줌\n"
WCMD_CONSTITLE,"Wine 명령 입력대기"
WCMD_VERSION,"CMD 버젼 %s\n\n"
WCMD_MOREPROMPT, " 더? "
WCMD_LINETOOLONG, "The input line is too long.\n"
}
......@@ -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"
}
......@@ -270,4 +270,5 @@ Skriv HELP <kommando> for mer informasjon om kommandoene ovenfor\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"
}
......@@ -267,4 +267,5 @@ Wpisz HELP <komenda> dla dokadniejszych informacji o komendzie\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"
}
......@@ -499,4 +499,5 @@ Digite HELP <comando> para mais informaes sobre alguns dos comandos acima\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"
}
......@@ -278,4 +278,5 @@ EXIT\t\t CMD\n\n\
WCMD_CONSTITLE," Wine"
WCMD_VERSION," CMD %s\n\n"
WCMD_MOREPROMPT, "? "
WCMD_LINETOOLONG, "The input line is too long.\n"
}
......@@ -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)
......@@ -274,4 +274,5 @@ Yukardaki komutlar hakknda daha fazla bilgi iin HELP <komut> girin\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"
}
......@@ -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
......@@ -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;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment