Commit 3915b8d2 authored by Gijs Vermeulen's avatar Gijs Vermeulen Committed by Alexandre Julliard

odbccp32: Handle NULL sizeout in SQLGetInstalledDrivers.

parent df3c911c
...@@ -583,7 +583,8 @@ BOOL WINAPI SQLGetInstalledDrivers(char *buf, WORD size, WORD *sizeout) ...@@ -583,7 +583,8 @@ BOOL WINAPI SQLGetInstalledDrivers(char *buf, WORD size, WORD *sizeout)
return FALSE; return FALSE;
} }
*sizeout = WideCharToMultiByte(CP_ACP, 0, wbuf, written, NULL, 0, NULL, NULL); if (sizeout)
*sizeout = WideCharToMultiByte(CP_ACP, 0, wbuf, written, NULL, 0, NULL, NULL);
WideCharToMultiByte(CP_ACP, 0, wbuf, written, buf, size, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, wbuf, written, buf, size, NULL, NULL);
heap_free(wbuf); heap_free(wbuf);
......
...@@ -643,6 +643,11 @@ static void test_SQLGetInstalledDrivers(void) ...@@ -643,6 +643,11 @@ static void test_SQLGetInstalledDrivers(void)
ok(!ret, "got %d\n", ret); ok(!ret, "got %d\n", ret);
check_error(ODBC_ERROR_INVALID_BUFF_LEN); check_error(ODBC_ERROR_INVALID_BUFF_LEN);
ret = SQLGetInstalledDrivers(buffer, 10, NULL);
ok(ret, "got %d\n", ret);
ok(strlen(buffer) == 8, "got len %u\n", lstrlenA(buffer));
ok(!buffer[9], "buffer not doubly null-terminated\n");
ret = SQLGetInstalledDrivers(buffer, 10, &written); ret = SQLGetInstalledDrivers(buffer, 10, &written);
ok(ret, "got %d\n", ret); ok(ret, "got %d\n", ret);
ok(strlen(buffer) == 8, "got len %u\n", lstrlenA(buffer)); ok(strlen(buffer) == 8, "got len %u\n", lstrlenA(buffer));
......
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