From: | martial(dot)guex(at)mutech(dot)ch |
---|---|
To: | pgsql-odbc(at)postgresql(dot)org |
Subject: | Patch to solve memory protect violation and clear __error_number after call CC_lookup_characterset |
Date: | 2020-03-22 13:43:59 |
Message-ID: | f34835d637ff57e34084096df114ad49@mutech.ch |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-odbc |
Hello,
I have detected fatal memory error protection on call strdup
connectio.c(1045) and wrong setting conn.__error_number on CC_lookup_lo
when "select oid, typbasetype from pg_type where typname = 'lo'" doesn't
return any record.
I used this patch to solve the problem on debian stretch with
odbc-postgresql:amd64 version 1:09.05.0400-2.
--- psqlodbc-09.05.0400.orig/connection.c
+++ psqlodbc-09.05.0400/connection.c
@@ -1041,12 +1041,13 @@ CC_connect(ConnectionClass *self, char *
if (retsend)
retsend = CC_send_settings(self,
GET_NAME(self->connInfo.conn_settings));
- if (CC_get_errornumber(self) > 0)
+ if ((CC_get_errornumber(self) > 0) && (CC_get_errormsg(self) != NULL))
saverr = strdup(CC_get_errormsg(self));
CC_clear_error(self); /* clear any error */
CC_lookup_lo(self); /* a hack to get the oid of
our large object oid type */
+ CC_clear_error(self); /* clear any error */
/* Multibyte handling */
CC_lookup_characterset(self);
if (CC_get_errornumber(self) > 0)
It's probably better to clear self.__error_number directly on
CC_lookup_lo and when error_number is equal 110.
Thank's for the job.
--
------------------------------------------
Martial Guex
Route des Alpes 7
1452 Les Rasses
Tél: +41 24 454 46 35
Fax: +41 24 454 46 32
Mobile: +41 79 767 27 02
Email: martial(dot)guex(at)mutech(dot)ch
WhatsApp:+41 79 767 27 02
From | Date | Subject | |
---|---|---|---|
Next Message | Andrus | 2020-03-22 14:30:27 | Re: How to fix psqlODBC driver regression to get error message details |
Previous Message | Beata Wojciechowska | 2020-03-17 01:22:23 | Bonus Serwis S.C. faktura_12/03/20/2929 |