Ge van Geldorp : shlwapi/tests: Prevent buffer overflow.
Alexandre Julliard
julliard at winehq.org
Mon Aug 24 10:09:38 CDT 2009
Module: wine
Branch: master
Commit: 2245e2c17e857c0c9795b9d3afec4eacd013ce67
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2245e2c17e857c0c9795b9d3afec4eacd013ce67
Author: Ge van Geldorp <ggeldorp at vmware.com>
Date: Mon Aug 24 14:25:40 2009 +0200
shlwapi/tests: Prevent buffer overflow.
---
dlls/shlwapi/tests/path.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/dlls/shlwapi/tests/path.c b/dlls/shlwapi/tests/path.c
index 52eee2d..5d64a24 100644
--- a/dlls/shlwapi/tests/path.c
+++ b/dlls/shlwapi/tests/path.c
@@ -690,7 +690,7 @@ static void test_PathAppendA(void)
{
char path[MAX_PATH];
char too_long[LONG_LEN];
- char one[HALF_LEN], two[HALF_LEN];
+ char half[HALF_LEN];
BOOL res;
lstrcpy(path, "C:\\one");
@@ -803,16 +803,16 @@ static void test_PathAppendA(void)
"Expected length of path to be zero, got %i\n", lstrlen(path));
/* both params combined are too long */
- memset(one, 'a', HALF_LEN);
- one[HALF_LEN - 1] = '\0';
- memset(two, 'b', HALF_LEN);
- two[HALF_LEN - 1] = '\0';
+ memset(path, 'a', HALF_LEN);
+ path[HALF_LEN - 1] = '\0';
+ memset(half, 'b', HALF_LEN);
+ half[HALF_LEN - 1] = '\0';
SetLastError(0xdeadbeef);
- res = PathAppendA(one, two);
+ res = PathAppendA(path, half);
ok(!res, "Expected failure\n");
- ok(lstrlen(one) == 0 ||
- broken(lstrlen(one) == (HALF_LEN - 1)), /* Win95 and some W2K */
- "Expected length of one to be zero, got %i\n", lstrlen(one));
+ ok(lstrlen(path) == 0 ||
+ broken(lstrlen(path) == (HALF_LEN - 1)), /* Win95 and some W2K */
+ "Expected length of path to be zero, got %i\n", lstrlen(path));
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
}
More information about the wine-cvs
mailing list