Commit a5317eb8 authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

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.
parent ba590a18
...@@ -406,7 +406,7 @@ BOOL WINAPI GetComputerNameA(LPSTR name, LPDWORD size) ...@@ -406,7 +406,7 @@ BOOL WINAPI GetComputerNameA(LPSTR name, LPDWORD size)
BOOL WINAPI GetComputerNameExA(COMPUTER_NAME_FORMAT type, LPSTR name, LPDWORD size) BOOL WINAPI GetComputerNameExA(COMPUTER_NAME_FORMAT type, LPSTR name, LPDWORD size)
{ {
char buf[256]; char buf[256];
int len = sizeof (buf), ret; int len = sizeof(buf) - 1, ret;
TRACE("%d, %p, %p\n", type, name, size); TRACE("%d, %p, %p\n", type, name, size);
switch( type ) switch( type )
{ {
...@@ -458,7 +458,7 @@ BOOL WINAPI GetComputerNameExA(COMPUTER_NAME_FORMAT type, LPSTR name, LPDWORD si ...@@ -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 ) BOOL WINAPI GetComputerNameExW( COMPUTER_NAME_FORMAT type, LPWSTR name, LPDWORD size )
{ {
char buf[256]; char buf[256];
int len = sizeof (buf), ret; int len = sizeof(buf) - 1, ret;
TRACE("%d, %p, %p\n", type, name, size); TRACE("%d, %p, %p\n", type, name, size);
switch( type ) switch( type )
......
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