From fb95a5ac385d4d23366ad427d512615c1927a46e Mon Sep 17 00:00:00 2001 From: Tom Parker-Shemilt Date: Sun, 10 Nov 2019 16:21:39 +0000 Subject: [PATCH] Fix list_drivers by a non-zero length buffer --- src/environment/list_data_sources.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/environment/list_data_sources.rs b/src/environment/list_data_sources.rs index e2da09ed..b14f5496 100644 --- a/src/environment/list_data_sources.rs +++ b/src/environment/list_data_sources.rs @@ -177,8 +177,13 @@ impl Environment { f: SqlInfoMethod, direction: ffi::FetchOrientation, ) -> Result<(ffi::SQLSMALLINT, ffi::SQLSMALLINT, usize)> { - let mut string_buf1 = [0; 0]; - let mut string_buf2 = [0; 0]; + // In theory, we should use zero-length buffers here + // However, if we do SQLDrivers gives us 0-length values for + // the attributes length, which is incorrect, so we allocated a + // reasonably large array which seems to make it do the right thing + let mut string_buf1 = [0; 1024]; + let mut string_buf2 = [0; 1024]; + let mut max1 = 0; let mut max2 = 0; let mut count = 0;