Patch for C0000005 crash on NULL szSchemaName in allow_public_schema()

Patch for C0000005 crash on NULL szSchemaName in allow_public_schema()

am 09.06.2010 19:50:18 von Peter Crabtree

--001636c5c0424f741604889ca1a9
Content-Type: text/plain; charset=UTF-8

I've encountered a crash trying to interface Visual FoxPro with
psqlODBC with the ANSI version when getting the structure of a table
without a primary key -- looks like a NULL pointer check was in the
wrong place (strlen() gets called on a not-verified-to-be-non-null
pointer).

I've attached a patch against the current CVS source.

I can't see any way this would impact the rest of the code, as this
function doesn't call any functions with side-effects, and this code
change only changes behavior of the function when it previously would
have crashed, and as such, I haven't done extensive testing, but I
have verified that this fixes the crash in Visual FoxPro, and it runs
fine in my limited testing.

The official FAQ said this is the place to send patches, but please
let me know if that's wrong, or there's anything else I need to do for
patch acceptance, like adding the issue to a tracker or what have you.

Thanks!

--001636c5c0424f741604889ca1a9
Content-Type: application/octet-stream;
name="info.c.allow_public_schema.nullcheck.patch"
Content-Disposition: attachment;
filename="info.c.allow_public_schema.nullcheck.patch"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_ga8d63rz0

SW5kZXg6IGluZm8uYwo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ClJDUyBmaWxl
OiAvY3Zzcm9vdC9wc3Fsb2RiYy9wc3Fsb2RiYy9pbmZvLmMsdgpyZXRyaWV2
aW5nIHJldmlzaW9uIDEuMTU5CmRpZmYgLXUgLXAgLXIxLjE1OSBpbmZvLmMK
LS0tIGluZm8uYwkyNCBKYW4gMjAxMCAwNzo1NjoxMyAtMDAwMAkxLjE1OQor
KysgaW5mby5jCTkgSnVuIDIwMTAgMTU6MzM6MTEgLTAwMDAKQEAgLTE0OTcs
MTEgKzE0OTcsMTMgQEAgYWxsb3dfcHVibGljX3NjaGVtYShDb25uZWN0aW9u
Q2xhc3MgKmNvbgogCWNvbnN0IGNoYXIgKnVzZXIgPSBDQ19nZXRfdXNlcm5h
bWUoY29ubik7CiAJc2l6ZV90CXVzZXJsZW4gPSBzdHJsZW4odXNlcik7CiAK
KwlpZiAoTlVMTCA9PSBzelNjaGVtYU5hbWUpCisJCXJldHVybiBGQUxTRTsK
KwogCWlmIChTUUxfTlRTID09IGNiU2NoZW1hTmFtZSkKIAkJY2JTY2hlbWFO
YW1lID0gc3RybGVuKHN6U2NoZW1hTmFtZSk7CiAKLQlyZXR1cm4gKE5VTEwg
IT0gc3pTY2hlbWFOYW1lICYmCi0JCWNiU2NoZW1hTmFtZSA9PSAoU1FMU01B
TExJTlQpIHVzZXJsZW4gJiYKKwlyZXR1cm4gKGNiU2NoZW1hTmFtZSA9PSAo
U1FMU01BTExJTlQpIHVzZXJsZW4gJiYKIAkJc3RybmljbXAoc3pTY2hlbWFO
YW1lLCB1c2VyLCB1c2VybGVuKSA9PSAwICYmCiAJCXN0cmljbXAoQ0NfZ2V0
X2N1cnJlbnRfc2NoZW1hKGNvbm4pLCBwdWJzdHIpID09IDApOwogfQo=

--001636c5c0424f741604889ca1a9
Content-Type: text/plain
Content-Disposition: inline
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable


--=20
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc

--001636c5c0424f741604889ca1a9--