Rob Shearman : kernel32: Fix an off-by-one error in
GetComputerNameExA/W.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Feb 21 13:18:40 CST 2007
Module: wine
Branch: master
Commit: a5317eb846e779159924cf0254b3837d10e28019
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a5317eb846e779159924cf0254b3837d10e28019
Author: Rob Shearman <rob at codeweavers.com>
Date: Wed Feb 21 17:13:25 2007 +0000
kernel32: Fix an off-by-one error in GetComputerNameExA/W.
The dns_* functions expect the input buffer to have space for size
characters plus the nul terminating character.
---
dlls/kernel32/computername.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/computername.c b/dlls/kernel32/computername.c
index d0d9d04..eebaed7 100644
--- a/dlls/kernel32/computername.c
+++ b/dlls/kernel32/computername.c
@@ -406,7 +406,7 @@ BOOL WINAPI GetComputerNameA(LPSTR name, LPDWORD size)
BOOL WINAPI GetComputerNameExA(COMPUTER_NAME_FORMAT type, LPSTR name, LPDWORD size)
{
char buf[256];
- int len = sizeof (buf), ret;
+ int len = sizeof(buf) - 1, ret;
TRACE("%d, %p, %p\n", type, name, size);
switch( type )
{
@@ -458,7 +458,7 @@ BOOL WINAPI GetComputerNameExA(COMPUTER_NAME_FORMAT type, LPSTR name, LPDWORD si
BOOL WINAPI GetComputerNameExW( COMPUTER_NAME_FORMAT type, LPWSTR name, LPDWORD size )
{
char buf[256];
- int len = sizeof (buf), ret;
+ int len = sizeof(buf) - 1, ret;
TRACE("%d, %p, %p\n", type, name, size);
switch( type )
More information about the wine-cvs
mailing list