Compare commits

..

No commits in common. "7ff64f8548f1b7b5bccb366d00214f3af1a47ec0" and "4d05d26268d7dc1681ff33c471f0ad9f431168bc" have entirely different histories.

8 changed files with 228 additions and 160 deletions

View File

@ -1,45 +0,0 @@
From 45f501e1be2db6b017cc242c79bfb9de32b332a1 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Mon, 29 Jan 2024 08:27:29 +0100
Subject: [PATCH] PostgreSQL driver: Fix incompatible pointer-to-integer types
These result in out-of-bounds stack writes on 64-bit architectures
(caller has 4 bytes, callee writes 8 bytes), and seem to have gone
unnoticed on little-endian architectures (although big-endian
architectures must be broken).
This change is required to avoid a build failure with GCC 14.
---
Drivers/Postgre7.1/info.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Drivers/Postgre7.1/info.c b/Drivers/Postgre7.1/info.c
index 63ac91f..2216ecd 100644
--- a/Drivers/Postgre7.1/info.c
+++ b/Drivers/Postgre7.1/info.c
@@ -1779,14 +1779,14 @@ char *table_name;
char index_name[MAX_INFO_STRING];
short fields_vector[8];
char isunique[10], isclustered[10];
-SDWORD index_name_len, fields_vector_len;
+SQLLEN index_name_len, fields_vector_len;
TupleNode *row;
int i;
HSTMT hcol_stmt;
StatementClass *col_stmt, *indx_stmt;
char column_name[MAX_INFO_STRING], relhasrules[MAX_INFO_STRING];
char **column_names = 0;
-Int4 column_name_len;
+SQLLEN column_name_len;
int total_columns = 0;
char error = TRUE;
ConnInfo *ci;
@@ -2136,7 +2136,7 @@ HSTMT htbl_stmt;
StatementClass *tbl_stmt;
char tables_query[STD_STATEMENT_LEN];
char attname[MAX_INFO_STRING];
-SDWORD attname_len;
+SQLLEN attname_len;
char pktab[MAX_TABLE_LEN + 1];
Int2 result_cols;

View File

@ -1,18 +0,0 @@
diff -rNu unixODBC-2.3.9/DriverManager/SQLConnect.c unixODBC-2.3.9-revised/DriverManager/SQLConnect.c
--- unixODBC-2.3.9/DriverManager/SQLConnect.c 2020-02-06 19:09:42.000000000 +0800
+++ unixODBC-2.3.9-revised/DriverManager/SQLConnect.c 2021-12-16 11:11:40.406421100 +0800
@@ -3746,12 +3746,10 @@
sprintf( connection -> msg, "\n\t\tEntry:\
\n\t\t\tConnection = %p\
\n\t\t\tServer Name = %s\
-\n\t\t\tUser Name = %s\
-\n\t\t\tAuthentication = %s",
+\n\t\t\tUser Name = %s",
connection,
__string_with_length( s1, server_name, name_length1 ),
- __string_with_length( s2, user_name, name_length2 ),
- __string_with_length_pass( s3, authentication, name_length3 ));
+ __string_with_length( s2, user_name, name_length2 ));
dm_log_write( __FILE__,
__LINE__,

18
keep-typedefs.patch Normal file
View File

@ -0,0 +1,18 @@
Upstream has decided to deprecate these typedefs, but experience so far
says that removing them just breaks code to little purpose.
diff -Naur unixODBC-2.2.14.orig/include/sqltypes.h unixODBC-2.2.14/include/sqltypes.h
--- unixODBC-2.2.14.orig/include/sqltypes.h 2008-10-31 12:21:53.000000000 -0400
+++ unixODBC-2.2.14/include/sqltypes.h 2009-02-16 13:28:50.000000000 -0500
@@ -170,6 +170,10 @@
typedef SQLUINTEGER SQLROWSETSIZE;
typedef SQLLEN SQLROWOFFSET;
*/
+typedef SQLULEN SQLROWCOUNT;
+typedef SQLULEN SQLROWSETSIZE;
+typedef SQLULEN SQLTRANSID;
+typedef SQLLEN SQLROWOFFSET;
#endif
#else
typedef long SQLINTEGER;

View File

@ -1,77 +0,0 @@
diff -rNu unixODBC-2.3.9/DriverManager/SQLGetDiagField.c unixODBC-new/DriverManager/SQLGetDiagField.c
--- unixODBC-2.3.9/DriverManager/SQLGetDiagField.c 2018-10-24 21:31:50.000000000 +0800
+++ unixODBC-new/DriverManager/SQLGetDiagField.c 2021-11-26 11:28:53.723787747 +0800
@@ -701,12 +701,16 @@
{
strcpy( diag_info_ptr, str );
}
- else
+ else if (buffer_length > 0)
{
ret = SQL_SUCCESS_WITH_INFO;
memcpy( diag_info_ptr, str, buffer_length - 1 );
(( char * ) diag_info_ptr )[ buffer_length - 1 ] = '\0';
}
+ else
+ {
+ return SQL_ERROR;
+ }
}
if ( string_length_ptr )
{
diff -rNu unixODBC-2.3.9/DriverManager/SQLGetStmtAttr.c unixODBC-new/DriverManager/SQLGetStmtAttr.c
--- unixODBC-2.3.9/DriverManager/SQLGetStmtAttr.c 2019-05-21 01:46:10.000000000 +0800
+++ unixODBC-new/DriverManager/SQLGetStmtAttr.c 2021-11-26 11:30:02.537064385 +0800
@@ -188,6 +188,10 @@
SQLRETURN ret;
SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ];
+ if (value == NULL) {
+ return SQL_ERROR;
+ }
+
/*
* check statement
*/
diff -rNu unixODBC-2.3.9/DriverManager/SQLGetStmtOption.c unixODBC-new/DriverManager/SQLGetStmtOption.c
--- unixODBC-2.3.9/DriverManager/SQLGetStmtOption.c 2018-10-24 21:34:27.000000000 +0800
+++ unixODBC-new/DriverManager/SQLGetStmtOption.c 2021-11-26 11:30:43.685827785 +0800
@@ -132,6 +132,10 @@
* check statement
*/
+ if (value == NULL) {
+ return SQL_ERROR;
+ }
+
if ( !__validate_stmt( statement ))
{
dm_log_write( __FILE__,
diff -rNu unixODBC-2.3.9/DriverManager/SQLParamOptions.c unixODBC-new/DriverManager/SQLParamOptions.c
--- unixODBC-2.3.9/DriverManager/SQLParamOptions.c 2018-05-30 17:24:07.000000000 +0800
+++ unixODBC-new/DriverManager/SQLParamOptions.c 2021-11-26 11:31:39.094855745 +0800
@@ -141,6 +141,10 @@
* check statement
*/
+ if (statement -> connection -> driver_act_ver != SQL_OV_ODBC2) {
+ return SQL_ERROR;
+ }
+
if ( !__validate_stmt( statement ))
{
dm_log_write( __FILE__,
diff -rNu unixODBC-2.3.9/DriverManager/SQLRowCount.c unixODBC-new/DriverManager/SQLRowCount.c
--- unixODBC-2.3.9/DriverManager/SQLRowCount.c 2018-05-30 17:24:07.000000000 +0800
+++ unixODBC-new/DriverManager/SQLRowCount.c 2021-11-26 11:32:24.967706787 +0800
@@ -139,6 +139,10 @@
SQLRETURN ret;
SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ];
+ if (!rowcount) {
+ return SQL_ERROR;
+ }
+
/*
* check statement
*/

206
so-version-bump.patch Normal file
View File

@ -0,0 +1,206 @@
Set the major .so version to 2 for all unixODBC shared libraries, to reflect
the incompatible ABI changes in 2.2.14.
diff -up unixODBC-2.3.3/Drivers/MiniSQL/Makefile.am.soname unixODBC-2.3.3/Drivers/MiniSQL/Makefile.am
--- unixODBC-2.3.3/Drivers/MiniSQL/Makefile.am.soname 2015-08-22 18:39:16.000000000 +0200
+++ unixODBC-2.3.3/Drivers/MiniSQL/Makefile.am 2015-08-25 12:27:47.005775376 +0200
@@ -193,6 +193,6 @@ EXTRA_DIST = \
_sqlFreeEnv.c \
_sqlFreeStmt.c
-libodbcmini_la_LDFLAGS = -no-undefined -version-info 1:0:0 \
+libodbcmini_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION) \
-L@msql_libraries@ -lmsql -module
diff -up unixODBC-2.3.3/Drivers/nn/Makefile.am.soname unixODBC-2.3.3/Drivers/nn/Makefile.am
--- unixODBC-2.3.3/Drivers/nn/Makefile.am.soname 2014-05-05 10:27:13.000000000 +0200
+++ unixODBC-2.3.3/Drivers/nn/Makefile.am 2015-08-25 12:27:47.007775386 +0200
@@ -2,7 +2,7 @@ lib_LTLIBRARIES = libnn.la
AM_CPPFLAGS = -I@top_srcdir@/include -I.
-libnn_la_LDFLAGS = -no-undefined -version-info 1:0:0 -module
+libnn_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION) -module
EXTRA_DIST = \
nnconfig.h \
diff -up unixODBC-2.3.3/Drivers/Postgre7.1/Makefile.am.soname unixODBC-2.3.3/Drivers/Postgre7.1/Makefile.am
--- unixODBC-2.3.3/Drivers/Postgre7.1/Makefile.am.soname 2014-05-05 10:27:13.000000000 +0200
+++ unixODBC-2.3.3/Drivers/Postgre7.1/Makefile.am 2015-08-25 12:27:47.009775396 +0200
@@ -3,7 +3,7 @@ lib_LTLIBRARIES = libodbcpsql.la
AM_CPPFLAGS = -I@top_srcdir@/include $(LTDLINCL)
libodbcpsql_la_LDFLAGS = \
- -version-info 2:0:0 \
+ -version-info $(LIB_VERSION) \
-no-undefined \
$(LIBSOCKET) $(LIBNSL) \
-export-dynamic \
diff -up unixODBC-2.3.3/Drivers/template/Makefile.am.soname unixODBC-2.3.3/Drivers/template/Makefile.am
--- unixODBC-2.3.3/Drivers/template/Makefile.am.soname 2014-05-05 10:27:13.000000000 +0200
+++ unixODBC-2.3.3/Drivers/template/Makefile.am 2015-08-25 12:27:47.012775410 +0200
@@ -2,7 +2,7 @@ lib_LTLIBRARIES = libtemplate.la
AM_CPPFLAGS = -I@top_srcdir@/include -I. $(LTDLINCL)
-libtemplate_la_LDFLAGS = -no-undefined -version-info 1:0:0
+libtemplate_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION)
EXTRA_DIST = \
driver.h \
diff -up unixODBC-2.3.3/DRVConfig/drvcfg1/Makefile.am.soname unixODBC-2.3.3/DRVConfig/drvcfg1/Makefile.am
--- unixODBC-2.3.3/DRVConfig/drvcfg1/Makefile.am.soname 2014-05-05 10:26:41.000000000 +0200
+++ unixODBC-2.3.3/DRVConfig/drvcfg1/Makefile.am 2015-08-25 12:27:47.014775420 +0200
@@ -2,7 +2,7 @@ lib_LTLIBRARIES = libodbcdrvcfg1S.la
AM_CPPFLAGS = -I@top_srcdir@/include $(LTDLINCL)
-libodbcdrvcfg1S_la_LDFLAGS = -no-undefined -version-info 1:0:0 -module
+libodbcdrvcfg1S_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION) -module
libodbcdrvcfg1S_la_SOURCES = drvcfg1.c
diff -up unixODBC-2.3.3/DRVConfig/drvcfg2/Makefile.am.soname unixODBC-2.3.3/DRVConfig/drvcfg2/Makefile.am
--- unixODBC-2.3.3/DRVConfig/drvcfg2/Makefile.am.soname 2014-05-05 10:26:41.000000000 +0200
+++ unixODBC-2.3.3/DRVConfig/drvcfg2/Makefile.am 2015-08-25 12:27:47.016775430 +0200
@@ -2,7 +2,7 @@ lib_LTLIBRARIES = libodbcdrvcfg2S.la
AM_CPPFLAGS = -I@top_srcdir@/include $(LTDLINCL)
-libodbcdrvcfg2S_la_LDFLAGS = -no-undefined -version-info 1:0:0 -module
+libodbcdrvcfg2S_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION) -module
libodbcdrvcfg2S_la_SOURCES = drvcfg2.c
diff -up unixODBC-2.3.3/DRVConfig/esoob/Makefile.am.soname unixODBC-2.3.3/DRVConfig/esoob/Makefile.am
--- unixODBC-2.3.3/DRVConfig/esoob/Makefile.am.soname 2014-05-05 10:26:41.000000000 +0200
+++ unixODBC-2.3.3/DRVConfig/esoob/Makefile.am 2015-08-25 12:27:47.017775434 +0200
@@ -2,7 +2,7 @@ lib_LTLIBRARIES = libesoobS.la
AM_CPPFLAGS = -I@top_srcdir@/include $(LTDLINCL)
-libesoobS_la_LDFLAGS = -no-undefined -version-info 1:0:0 -module
+libesoobS_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION) -module
libesoobS_la_SOURCES = esoobS.c
diff -up unixODBC-2.3.3/DRVConfig/Mimer/Makefile.am.soname unixODBC-2.3.3/DRVConfig/Mimer/Makefile.am
--- unixODBC-2.3.3/DRVConfig/Mimer/Makefile.am.soname 2014-05-05 10:26:41.000000000 +0200
+++ unixODBC-2.3.3/DRVConfig/Mimer/Makefile.am 2015-08-25 12:27:47.019775444 +0200
@@ -2,7 +2,7 @@ lib_LTLIBRARIES = libmimerS.la
AM_CPPFLAGS = -I@top_srcdir@/include $(LTDLINCL)
-libmimerS_la_LDFLAGS = -no-undefined -version-info 1:0:0 -module
+libmimerS_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION) -module
libmimerS_la_SOURCES = mimerS.c
diff -up unixODBC-2.3.3/DRVConfig/MiniSQL/Makefile.am.soname unixODBC-2.3.3/DRVConfig/MiniSQL/Makefile.am
--- unixODBC-2.3.3/DRVConfig/MiniSQL/Makefile.am.soname 2014-05-05 10:26:41.000000000 +0200
+++ unixODBC-2.3.3/DRVConfig/MiniSQL/Makefile.am 2015-08-25 12:27:47.020775449 +0200
@@ -2,7 +2,7 @@ lib_LTLIBRARIES = libodbcminiS.la
AM_CPPFLAGS = -I@top_srcdir@/include $(LTDLINCL)
-libodbcminiS_la_LDFLAGS = -no-undefined -version-info 1:0:0 -module
+libodbcminiS_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION) -module
libodbcminiS_la_SOURCES = odbcminiS.c
diff -up unixODBC-2.3.3/DRVConfig/MySQL/Makefile.am.soname unixODBC-2.3.3/DRVConfig/MySQL/Makefile.am
--- unixODBC-2.3.3/DRVConfig/MySQL/Makefile.am.soname 2014-05-05 10:26:41.000000000 +0200
+++ unixODBC-2.3.3/DRVConfig/MySQL/Makefile.am 2015-08-25 12:27:47.023775464 +0200
@@ -2,7 +2,7 @@ lib_LTLIBRARIES = libodbcmyS.la
AM_CPPFLAGS = -I@top_srcdir@/include $(LTDLINCL)
-libodbcmyS_la_LDFLAGS = -no-undefined -version-info 1:0:0 -module
+libodbcmyS_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION) -module
libodbcmyS_la_SOURCES = odbcmyS.c
diff -up unixODBC-2.3.3/DRVConfig/nn/Makefile.am.soname unixODBC-2.3.3/DRVConfig/nn/Makefile.am
--- unixODBC-2.3.3/DRVConfig/nn/Makefile.am.soname 2014-05-05 10:26:41.000000000 +0200
+++ unixODBC-2.3.3/DRVConfig/nn/Makefile.am 2015-08-25 12:27:47.024775469 +0200
@@ -2,7 +2,7 @@ lib_LTLIBRARIES = libodbcnnS.la
AM_CPPFLAGS = -I@top_srcdir@/include $(LTDLINCL)
-libodbcnnS_la_LDFLAGS = -no-undefined -version-info 1:0:0 -module
+libodbcnnS_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION) -module
libodbcnnS_la_SOURCES = drvcfg.c
diff -up unixODBC-2.3.3/DRVConfig/oplodbc/Makefile.am.soname unixODBC-2.3.3/DRVConfig/oplodbc/Makefile.am
--- unixODBC-2.3.3/DRVConfig/oplodbc/Makefile.am.soname 2014-05-05 10:26:41.000000000 +0200
+++ unixODBC-2.3.3/DRVConfig/oplodbc/Makefile.am 2015-08-25 12:27:47.026775478 +0200
@@ -2,7 +2,7 @@ lib_LTLIBRARIES = liboplodbcS.la
AM_CPPFLAGS = -I@top_srcdir@/include $(LTDLINCL)
-liboplodbcS_la_LDFLAGS = -no-undefined -version-info 1:0:0 -module
+liboplodbcS_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION) -module
liboplodbcS_la_SOURCES = oplodbc.c
diff -up unixODBC-2.3.3/DRVConfig/Oracle/Makefile.am.soname unixODBC-2.3.3/DRVConfig/Oracle/Makefile.am
--- unixODBC-2.3.3/DRVConfig/Oracle/Makefile.am.soname 2014-05-05 10:26:41.000000000 +0200
+++ unixODBC-2.3.3/DRVConfig/Oracle/Makefile.am 2015-08-25 12:27:47.027775483 +0200
@@ -2,7 +2,7 @@ lib_LTLIBRARIES = liboraodbcS.la
AM_CPPFLAGS = -I@top_srcdir@/include $(LTDLINCL)
-liboraodbcS_la_LDFLAGS = -no-undefined -version-info 1:0:0 -module
+liboraodbcS_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION) -module
liboraodbcS_la_SOURCES = oraodbcS.c
diff -up unixODBC-2.3.3/DRVConfig/PostgreSQL/Makefile.am.soname unixODBC-2.3.3/DRVConfig/PostgreSQL/Makefile.am
--- unixODBC-2.3.3/DRVConfig/PostgreSQL/Makefile.am.soname 2014-05-05 10:26:41.000000000 +0200
+++ unixODBC-2.3.3/DRVConfig/PostgreSQL/Makefile.am 2015-08-25 12:27:47.029775493 +0200
@@ -2,7 +2,7 @@ lib_LTLIBRARIES = libodbcpsqlS.la
AM_CPPFLAGS = -I@top_srcdir@/include $(LTDLINCL)
-libodbcpsqlS_la_LDFLAGS = -no-undefined -version-info 1:0:0 -module
+libodbcpsqlS_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION) -module
libodbcpsqlS_la_SOURCES = odbcpsqlS.c
diff -up unixODBC-2.3.3/DRVConfig/sapdb/Makefile.am.soname unixODBC-2.3.3/DRVConfig/sapdb/Makefile.am
--- unixODBC-2.3.3/DRVConfig/sapdb/Makefile.am.soname 2014-05-05 10:26:41.000000000 +0200
+++ unixODBC-2.3.3/DRVConfig/sapdb/Makefile.am 2015-08-25 12:27:47.031775503 +0200
@@ -2,7 +2,7 @@ lib_LTLIBRARIES = libsapdbS.la
AM_CPPFLAGS = -I@top_srcdir@/include $(LTDLINCL)
-libsapdbS_la_LDFLAGS = -no-undefined -version-info 1:0:0 -module
+libsapdbS_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION) -module
libsapdbS_la_SOURCES = sapdb.c
diff -up unixODBC-2.3.3/DRVConfig/tds/Makefile.am.soname unixODBC-2.3.3/DRVConfig/tds/Makefile.am
--- unixODBC-2.3.3/DRVConfig/tds/Makefile.am.soname 2014-05-05 10:26:41.000000000 +0200
+++ unixODBC-2.3.3/DRVConfig/tds/Makefile.am 2015-08-25 12:27:47.032775507 +0200
@@ -2,7 +2,7 @@ lib_LTLIBRARIES = libtdsS.la
AM_CPPFLAGS = -I@top_srcdir@/include $(LTDLINCL)
-libtdsS_la_LDFLAGS = -no-undefined -version-info 1:0:0 -module
+libtdsS_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION) -module
libtdsS_la_SOURCES = tdsS.c
diff -up unixODBC-2.3.3/DRVConfig/txt/Makefile.am.soname unixODBC-2.3.3/DRVConfig/txt/Makefile.am
--- unixODBC-2.3.3/DRVConfig/txt/Makefile.am.soname 2014-05-05 10:26:41.000000000 +0200
+++ unixODBC-2.3.3/DRVConfig/txt/Makefile.am 2015-08-25 12:27:47.034775517 +0200
@@ -2,7 +2,7 @@ lib_LTLIBRARIES = libodbctxtS.la
AM_CPPFLAGS = -I@top_srcdir@/include $(LTDLINCL)
-libodbctxtS_la_LDFLAGS = -no-undefined -version-info 1:0:0 -module
+libodbctxtS_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION) -module
libodbctxtS_la_SOURCES = drvcfg.c

BIN
unixODBC-2.3.7.tar.gz Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,14 +1,13 @@
Name: unixODBC
Version: 2.3.9
Release: 4
Version: 2.3.7
Release: 2
Summary: Open-source project that implements the ODBC API
License: GPLv2+ and LGPLv2+
URL: http://www.unixODBC.org/
Source: http://www.unixODBC.org/%{name}-%{version}.tar.gz
Source1: odbcinst.ini
Patch0000: null_dereference_check.patch
Patch0001: delete_password.patch
Patch6001: backport-0001-CVE-2024-1013.patch
Patch0000: so-version-bump.patch
Patch0001: keep-typedefs.patch
Conflicts: iodbc
BuildRequires: automake autoconf libtool libtool-ltdl-devel bison flex readline-devel
@ -91,20 +90,5 @@ find doc -name 'Makefile*' | xargs rm
%exclude %{_datadir}/libtool
%changelog
* Thu Oct 24 2024 Funda Wang <fundawang@yeah.net> - 2.3.9-4
- fix CVE-2024-1013
* Thu Dec 16 2021 Haoran Yang <yanghaoran7@huawei.com> - 2.3.9-3
- add delete_password.patch (hiding password in unixODBC log)
* Fri Nov 26 2021 Haoran Yang <yanghaoran7@huawei.com> - 2.3.9-2
- add null_dereference_check.patch
* Thu Nov 25 2021 Haoran Yang <yanghaoran7@huawei.com> - 2.3.9-1
- update unixODBC from version 2.3.7 to 2.3.9 and delete old patches
* Mon Nov 8 2021 Haoran Yang <yanghaoran7@huawei.com> - 2.3.7-3
- fix some leaks and eliminate duplicated code
* Tue Nov 5 2019 Lijin Yang <yanglijin@huawei.com> - 1.1.0-14
- Package init