[PATCH] shell32: Fixed strncpy/strcat sizes (Coverity)
Marcus Meissner
marcus at jet.franken.de
Tue Jun 28 02:04:37 CDT 2011
Hi,
Fixed the borderline conditions a bit, also strncpy() of a MAX_PATH large
string will but no \0 in, so put a safe one in. In that case strncat() does
not need a size, we know that we have enough space.
(Also strncat(buf,"*",1) is a bit useless anyway.)
CID 1196
Ciao, Marcus
---
dlls/shell32/tests/brsfolder.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/shell32/tests/brsfolder.c b/dlls/shell32/tests/brsfolder.c
index c3e9d3c..8857111 100644
--- a/dlls/shell32/tests/brsfolder.c
+++ b/dlls/shell32/tests/brsfolder.c
@@ -36,12 +36,13 @@ static LPITEMIDLIST selected_folder_pidl;
static int get_number_of_folders(LPCSTR path)
{
int number_of_folders = 0;
- char path_search_string[MAX_PATH];
+ char path_search_string[MAX_PATH+2];
WIN32_FIND_DATA find_data;
HANDLE find_handle;
+ path_search_string[MAX_PATH] = '\0';
strncpy(path_search_string, path, MAX_PATH);
- strncat(path_search_string, "*", 1);
+ strcat(path_search_string, "*");
find_handle = FindFirstFile(path_search_string, &find_data);
if (find_handle == INVALID_HANDLE_VALUE)
--
1.7.3.4
More information about the wine-patches
mailing list