[packages/unixODBC] Rel 2. Backport upstream memory-safety fixes.

arekm arekm at pld-linux.org
Thu Oct 29 09:10:56 CET 2026


commit 39263be27dbfc6bbac253568e2bcd30a729b8abe
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Thu Oct 29 02:08:00 2026 +0100

    Rel 2. Backport upstream memory-safety fixes.

 unixODBC-SQLGetInfoW-overflow.patch   | 24 +++++++++++++++++++
 unixODBC-isql-get_args-overflow.patch | 40 ++++++++++++++++++++++++++++++++
 unixODBC-pool-null-credentials.patch  | 43 +++++++++++++++++++++++++++++++++++
 unixODBC.spec                         | 13 ++++++++---
 4 files changed, 117 insertions(+), 3 deletions(-)
---
diff --git a/unixODBC.spec b/unixODBC.spec
index 2d60936..0a6b201 100644
--- a/unixODBC.spec
+++ b/unixODBC.spec
@@ -2,14 +2,17 @@ Summary:	unixODBC - a complete, free/open, ODBC solution for UNIX/Linux
 Summary(pl.UTF-8):	unixODBC - kompletne, darmowe/otwarte ODBC dla UNIX/Linuksa
 Name:		unixODBC
 Version:	2.3.14
-Release:	1
+Release:	2
 License:	LGPL v2+ (libraries), GPL v2+ (programs, News Server driver)
 Group:		Libraries
-Source0:	ftp://ftp.unixodbc.org/pub/unixODBC/%{name}-%{version}.tar.gz
+Source0:	https://www.unixodbc.org/%{name}-%{version}.tar.gz
 # Source0-md5:	316cede4896eb768fe4572d71dc04537
 Patch0:		%{name}-bool.patch
 Patch1:		%{name}-includes.patch
 Patch2:		%{name}-proto.patch
+Patch3:		%{name}-SQLGetInfoW-overflow.patch
+Patch4:		%{name}-isql-get_args-overflow.patch
+Patch5:		%{name}-pool-null-credentials.patch
 URL:		https://www.unixodbc.org/
 BuildRequires:	flex
 BuildRequires:	libltdl-devel >= 2:2
@@ -66,10 +69,14 @@ Biblioteki statyczne unixODBC.
 %patch -P0 -p1
 %patch -P1 -p1
 %patch -P2 -p1
+%patch -P3 -p1
+%patch -P4 -p1
+%patch -P5 -p1
 
 %build
 CPPFLAGS="%{rpmcppflags} -D_DEFAULT_SOURCE"
-CFLAGS="%{rpmcflags} -Wno-error=incompatible-pointer-types"
+# nn driver stores converters of different types in unprototyped () pointers
+CFLAGS="%{rpmcflags} -std=gnu17"
 %configure \
 	--enable-driver-config \
 	--enable-drivers \
diff --git a/unixODBC-SQLGetInfoW-overflow.patch b/unixODBC-SQLGetInfoW-overflow.patch
new file mode 100644
index 0000000..ac8929f
--- /dev/null
+++ b/unixODBC-SQLGetInfoW-overflow.patch
@@ -0,0 +1,24 @@
+From 46d06aa1351d32c73238a575f910cbc0d335c9a8 Mon Sep 17 00:00:00 2001
+From: lurcher <nick at lurcher.org>
+Date: Tue, 19 May 2026 14:09:58 +0100
+Subject: [PATCH] Fix buffer overflow in SQLGetInfoW #235
+
+---
+ DriverManager/SQLGetInfoW.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/DriverManager/SQLGetInfoW.c b/DriverManager/SQLGetInfoW.c
+index fab9ca4..8dc1887 100644
+--- a/DriverManager/SQLGetInfoW.c
++++ b/DriverManager/SQLGetInfoW.c
+@@ -444,6 +444,7 @@ SQLRETURN SQLGetInfoW( SQLHDBC connection_handle,
+               case SQL_OUTER_JOINS:
+                 if ( SQL_SUCCEEDED( ret ) && info_value && buffer_length > 0 )
+                 {
++                    buffer_length = buffer_length / sizeof( SQLWCHAR );
+                     as1 = malloc( buffer_length + 1 );
+                 }
+                 break;
+-- 
+2.56.0
+
diff --git a/unixODBC-isql-get_args-overflow.patch b/unixODBC-isql-get_args-overflow.patch
new file mode 100644
index 0000000..f0e4404
--- /dev/null
+++ b/unixODBC-isql-get_args-overflow.patch
@@ -0,0 +1,40 @@
+From a9e798925c4a4c8f100caca07503aa85be64fba1 Mon Sep 17 00:00:00 2001
+From: tomhanks <xiejing at kylinos.cn>
+Date: Wed, 26 Aug 2026 17:33:28 +0800
+Subject: [PATCH] Fix buffer overflow in isql get_args() (#236)
+
+---
+ exe/isql.c | 11 ++++++-----
+ 1 file changed, 6 insertions(+), 5 deletions(-)
+
+diff --git a/exe/isql.c b/exe/isql.c
+index fd13e86..f2b0f79 100644
+--- a/exe/isql.c
++++ b/exe/isql.c
+@@ -1867,17 +1867,18 @@ static int get_args(char *string, char **args, int maxarg) {
+     {
+         p = NULL;
+ 
++        if (nargs >= maxarg)
++        {
++            free(copy);
++            return maxarg;
++        }
++
+         if (strcmp(arg, "\"\"") == 0)
+             args[nargs++] = strdup("");
+         else if (strcmp(arg, "null") == 0)
+             args[nargs++] = NULL;
+         else
+             args[nargs++] = strdup(arg);
+-        if (nargs > maxarg)
+-        {
+-            free(copy);
+-            return maxarg;
+-        }
+     }
+     free(copy);
+     return nargs;
+-- 
+2.56.0
+
diff --git a/unixODBC-pool-null-credentials.patch b/unixODBC-pool-null-credentials.patch
new file mode 100644
index 0000000..cb19659
--- /dev/null
+++ b/unixODBC-pool-null-credentials.patch
@@ -0,0 +1,43 @@
+From 1aaac48f9d5f0dd3370bb2a19073e5afa7d865f3 Mon Sep 17 00:00:00 2001
+From: Ilia Alshanetsky <ilia at ilia.ws>
+Date: Tue, 30 Jun 2026 03:47:53 -0400
+Subject: [PATCH] Fix NULL deref in connection pool credential match (#237)
+
+sql_strcmp() dereferences the user name or password while matching a
+pooled connection. For a DSN with no credentials the application passes
+NULL, and copy_nts() stores it as an empty string on the pooled side, so
+the lengths compare equal and strcmp(NULL, "") crashes inside SQLConnect.
+The server operand was already guarded; user and password were not. Treat
+a NULL operand as "".
+---
+ DriverManager/SQLConnect.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+diff --git a/DriverManager/SQLConnect.c b/DriverManager/SQLConnect.c
+index f3480e7..85a4d42 100644
+--- a/DriverManager/SQLConnect.c
++++ b/DriverManager/SQLConnect.c
+@@ -2906,6 +2906,20 @@ static int sql_strcmp( SQLCHAR *s1, SQLCHAR *s2, SQLSMALLINT l1, SQLSMALLINT l2
+         return 1;
+     }
+ 
++    /*
++     * A missing user name or password is passed as a NULL pointer, but
++     * copy_nts() stores it as an empty string on the pooled side. Treat
++     * NULL as "" so the comparison matches instead of dereferencing NULL.
++     */
++    if ( s1 == NULL )
++    {
++        s1 = (SQLCHAR *) "";
++    }
++    if ( s2 == NULL )
++    {
++        s2 = (SQLCHAR *) "";
++    }
++
+     if ( l1 == SQL_NTS )
+     {
+         return strcmp((char*) s1, (char*)s2 );
+-- 
+2.56.0
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/unixODBC.git/commitdiff/39263be27dbfc6bbac253568e2bcd30a729b8abe



More information about the pld-cvs-commit mailing list