From afb39ce8faae5b9e89ecb3c679234e0d2ce2acdc Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Sun, 20 Jan 2008 12:21:39 +0000 Subject: [PATCH] fix a buffer overflow svn path=/trunk/; revision=31901 --- reactos/base/shell/cmd/batch.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/reactos/base/shell/cmd/batch.c b/reactos/base/shell/cmd/batch.c index c6b3b568351..6bb106526e8 100644 --- a/reactos/base/shell/cmd/batch.c +++ b/reactos/base/shell/cmd/batch.c @@ -262,7 +262,10 @@ BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param) /* Then we are transferring to another batch */ CloseHandle (bc->hBatchFile); bc->hBatchFile = INVALID_HANDLE_VALUE; - cmd_free (bc->params); + if (bc->params) + cmd_free (bc->params); + if (bc->raw_params) + cmd_free (bc->raw_params); } bc->hBatchFile = hFile; @@ -280,7 +283,7 @@ BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param) bc->raw_params = (TCHAR*) cmd_alloc((_tcslen(param)+1) * sizeof(TCHAR)); if (bc->raw_params != NULL) { - memset (bc->raw_params, 0, _tcslen(bc->raw_params) * sizeof(TCHAR)); + memset (bc->raw_params, 0, (_tcslen(param)+1) * sizeof(TCHAR)); _tcscpy(bc->raw_params,param); } else