Open
fix CVE-2021-42392 #18
fix CVE-2021-42392 #18
Open
pop-code123Add on Jun 4
Total: 2 files changed+57-1
@@ -0,0 +1,51 @@
1+From e5c766de3edd5ddbdee4ac75ad53658ec6dffe35 Mon Sep 17 00:00:00 2001
陈棋德

既然来自debian,补丁头没必要从debian的开发人员修改掉,这么做不合适

likedislike
2+From: pop-code123 <puhongyu@kylinsec.com.cn>
3+Date: Thu, 4 Jun 2026 23:21:48 +0800
4+Subject: [PATCH] fix CVE-2021-42392
5+ 
6+Origin: https://github.com/h2database/h2database/commit/956c6241868332c5b440f5d55ea8fdc1e51ae4fd
7+Origin: https://github.com/h2database/h2database/commit/41dd2a4cf89da9dd18239debbf73f88da6184ec7
8+ 
9+The "linked tables" vulnerability can only be exploited with ADMIN rights and
10+thus the second part of the patch was omitted.
11+ 
12+---
13+ src/main/org/h2/util/JdbcUtils.java | 3 +++
14+ src/test/org/h2/test/unit/TestTools.java | 7 +++++++
15+ 2 files changed, 10 insertions(+)
16+ 
17+diff --git a/src/main/org/h2/util/JdbcUtils.java b/src/main/org/h2/util/JdbcUtils.java
18+index e92a352..e914094 100644
19+--- a/src/main/org/h2/util/JdbcUtils.java
20++++ b/src/main/org/h2/util/JdbcUtils.java
21+@@ -296,6 +296,9 @@ public class JdbcUtils {
22+ if (java.sql.Driver.class.isAssignableFrom(d)) {
23+ return DriverManager.getConnection(url, prop);
24+ } else if (javax.naming.Context.class.isAssignableFrom(d)) {
25++ if (!url.startsWith("java:")) {
26++ throw new SQLException("Only java scheme is supported for JNDI lookups", "08001");
27++ }
28+ // JNDI context
29+ try {
30+ Context context = (Context) d.newInstance();
31+diff --git a/src/test/org/h2/test/unit/TestTools.java b/src/test/org/h2/test/unit/TestTools.java
32+index 7c3ec73..f641871 100644
33+--- a/src/test/org/h2/test/unit/TestTools.java
34++++ b/src/test/org/h2/test/unit/TestTools.java
35+@@ -466,6 +466,13 @@ public class TestTools extends TestBase {
36+ JdbcUtils.getDriver("jdbc:postgresql:test"));
37+ assertEquals(null,
38+ JdbcUtils.getDriver("jdbc:unknown:test"));
39++ try {
40++ JdbcUtils.getConnection("javax.naming.InitialContext", "ldap://localhost/ds", "sa", "");
41++ fail("Expected SQLException: 08001");
42++ } catch (SQLException e) {
43++ assertEquals("08001", e.getSQLState());
44++ assertEquals("Only java scheme is supported for JNDI lookups", e.getMessage());
45++ }
46+ }
47+
48+ private void testWrongServer() throws Exception {
49+--
50+2.43.0
51+ 
Mh2.spec+6-1
@@ -1,12 +1,13 @@
1Name: h21Name: h2
2Version: 1.4.1962Version: 1.4.196
3-Release: 53+Release: 6
4Summary: Java SQL database4Summary: Java SQL database
5License: (EPL-1.0 or MPLv2.0 or LGPLv3+) and ASL 2.05License: (EPL-1.0 or MPLv2.0 or LGPLv3+) and ASL 2.0
6URL: http://www.h2database.com6URL: http://www.h2database.com
7Source0: http://www.h2database.com/h2-2017-06-10.zip7Source0: http://www.h2database.com/h2-2017-06-10.zip
8Source1: https://repo1.maven.org/maven2/com/h2database/h2/%{version}/h2-%{version}.pom8Source1: https://repo1.maven.org/maven2/com/h2database/h2/%{version}/h2-%{version}.pom
9Patch0: port-to-lucene-6.patch9Patch0: port-to-lucene-6.patch
10+Patch1: CVE-2021-42392.patch
10BuildArch: noarch11BuildArch: noarch
11BuildRequires: javapackages-local lucene >= 6.1.0 lucene-analysis >= 6.1.012BuildRequires: javapackages-local lucene >= 6.1.0 lucene-analysis >= 6.1.0
12BuildRequires: lucene-queryparser >= 6.1.0 slf4j felix-osgi-core glassfish-servlet-api <= 3.1.0 jts13BuildRequires: lucene-queryparser >= 6.1.0 slf4j felix-osgi-core glassfish-servlet-api <= 3.1.0 jts
@@ -23,6 +24,7 @@ This package contains the API documentation for %{name}.
23%prep24%prep
24%setup -q -n %{name}25%setup -q -n %{name}
25%patch 0 -p226%patch 0 -p2
27+%patch 1 -p1
26rm src/main/org/h2/util/OsgiDataSourceFactory.java28rm src/main/org/h2/util/OsgiDataSourceFactory.java
27sed -i -e '/OsgiDataSourceFactory/d' src/main/org/h2/util/DbDriverActivator.java29sed -i -e '/OsgiDataSourceFactory/d' src/main/org/h2/util/DbDriverActivator.java
28sed -i -e '/org.osgi.service.jdbc/d' src/main/META-INF/MANIFEST.MF30sed -i -e '/org.osgi.service.jdbc/d' src/main/META-INF/MANIFEST.MF
@@ -64,6 +66,9 @@ sh build.sh jar docs
64%license src/docsrc/html/license.html66%license src/docsrc/html/license.html
65 67 
66%changelog68%changelog
69+* Thu Jun 4 2026 puhongyu <puhongyu@kylinsec.com.cn> - 1.4.196-6
70+- fix CVE-2021-42392
71+ 
67* Mon Dec 16 2024 litian <dev11105@linx-info.com> - 1.4.196-572* Mon Dec 16 2024 litian <dev11105@linx-info.com> - 1.4.196-5
68- fix %patchN is deprecated warning73- fix %patchN is deprecated warning
69 74