From 36ddab891a43b6f84ef1a316d44e1c67ff11df94 Mon Sep 17 00:00:00 2001
From: Jitka Plesnikova <jplesnik(a)redhat.com>
Date: Tue, 4 Jul 2017 15:29:51 +0200
Subject: 4.043 bump; Fixed CVE-2017-10788 (bug #1467600)
---
.gitignore | 1 +
...r-free-after-calling-mysql_stmt_close.patch.txt | 52 ++++++++++++++++++++++
perl-DBD-MySQL.spec | 10 ++++-
sources | 2 +-
4 files changed, 62 insertions(+), 3 deletions(-)
create mode 100644
DBD-mysql-4.043-Fix-use-after-free-after-calling-mysql_stmt_close.patch.txt
diff --git a/.gitignore b/.gitignore
index 57a296e..28c9453 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,3 +24,4 @@ DBD-mysql-4.017.tar.gz
/DBD-mysql-4.040.tar.gz
/DBD-mysql-4.041.tar.gz
/DBD-mysql-4.042.tar.gz
+/DBD-mysql-4.043.tar.gz
diff --git a/DBD-mysql-4.043-Fix-use-after-free-after-calling-mysql_stmt_close.patch.txt
b/DBD-mysql-4.043-Fix-use-after-free-after-calling-mysql_stmt_close.patch.txt
new file mode 100644
index 0000000..96e4f48
--- /dev/null
+++ b/DBD-mysql-4.043-Fix-use-after-free-after-calling-mysql_stmt_close.patch.txt
@@ -0,0 +1,52 @@
+From 9ce10cfae7138c37c3a0cb2ba2a1d682482943d0 Mon Sep 17 00:00:00 2001
+From: Pali <pali(a)cpan.org>
+Date: Sun, 25 Jun 2017 10:07:39 +0200
+Subject: [PATCH] Fix use-after-free after calling mysql_stmt_close()
+
+Ignore return value from mysql_stmt_close() and also its error message
+because it points to freed memory after mysql_stmt_close() was called.
+---
+ dbdimp.c | 8 ++------
+ mysql.xs | 7 ++-----
+ 2 files changed, 4 insertions(+), 11 deletions(-)
+
+diff --git a/dbdimp.c b/dbdimp.c
+index c60a5f6..a6410e5 100644
+--- a/dbdimp.c
++++ b/dbdimp.c
+@@ -4894,12 +4894,8 @@ void dbd_st_destroy(SV *sth, imp_sth_t *imp_sth) {
+
+ if (imp_sth->stmt)
+ {
+- if (mysql_stmt_close(imp_sth->stmt))
+- {
+- do_error(DBIc_PARENT_H(imp_sth), mysql_stmt_errno(imp_sth->stmt),
+- mysql_stmt_error(imp_sth->stmt),
+- mysql_stmt_sqlstate(imp_sth->stmt));
+- }
++ mysql_stmt_close(imp_sth->stmt);
++ imp_sth->stmt= NULL;
+ }
+ #endif
+
+diff --git a/mysql.xs b/mysql.xs
+index 55376e1..affde59 100644
+--- a/mysql.xs
++++ b/mysql.xs
+@@ -434,11 +434,8 @@ do(dbh, statement, attr=Nullsv, ...)
+ if (bind)
+ Safefree(bind);
+
+- if(mysql_stmt_close(stmt))
+- {
+- fprintf(stderr, "\n failed while closing the statement");
+- fprintf(stderr, "\n %s", mysql_stmt_error(stmt));
+- }
++ mysql_stmt_close(stmt);
++ stmt= NULL;
+
+ if (retval == -2) /* -2 means error */
+ {
+--
+1.7.9.5
+
diff --git a/perl-DBD-MySQL.spec b/perl-DBD-MySQL.spec
index 8902cc9..5937418 100644
--- a/perl-DBD-MySQL.spec
+++ b/perl-DBD-MySQL.spec
@@ -1,11 +1,13 @@
Name: perl-DBD-MySQL
-Version: 4.042
+Version: 4.043
Release: 1%{?dist}
Summary: A MySQL interface for Perl
Group: Development/Libraries
License: GPL+ or Artistic
URL:
http://search.cpan.org/dist/DBD-mysql/
Source0:
http://www.cpan.org/authors/id/M/MI/MICHIELB/DBD-mysql-%{version}.tar.gz
+# Fix for CVE-2017-10788
+Patch0:
DBD-mysql-4.043-Fix-use-after-free-after-calling-mysql_stmt_close.patch.txt
BuildRequires: mariadb, mariadb-devel, zlib-devel
BuildRequires: coreutils
BuildRequires: findutils
@@ -17,7 +19,6 @@ BuildRequires: perl(Config)
BuildRequires: perl(Data::Dumper)
BuildRequires: perl(DBI) >= 1.609
BuildRequires: perl(DBI::DBD)
-BuildRequires: perl(Devel::CheckLib)
BuildRequires: perl(DynaLoader)
BuildRequires: perl(ExtUtils::MakeMaker)
BuildRequires: perl(File::Basename)
@@ -41,6 +42,7 @@ management system.
%prep
%setup -q -n DBD-mysql-%{version}
+%patch0 -p1
# Correct file permissions
find . -type f | xargs chmod -x
@@ -68,6 +70,10 @@ find %{buildroot} -type f -name '*.bs' -empty -delete
%{_mandir}/man3/*.3*
%changelog
+* Fri Jun 30 2017 Jitka Plesnikova <jplesnik(a)redhat.com> - 4.043-1
+- 4.043 bump
+- Fixed CVE-2017-10788 (bug #1467600)
+
* Thu Mar 09 2017 Jitka Plesnikova <jplesnik(a)redhat.com> - 4.042-1
- 4.042 bump
diff --git a/sources b/sources
index c822ef2..430338d 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-SHA512 (DBD-mysql-4.042.tar.gz) =
fe3c9e1e325f7056da783e0ea33f9a7810f25f3d9cd2c9a4bf4037b20a2148f2291b2f90d44730e63c7902b45e26993a7f9fcf1b3bf8d1bc5d3fca99893a019e
+SHA512 (DBD-mysql-4.043.tar.gz) =
ef845052caabba7060e2e21d81f0791003509ec56741d92ff3a82196b528f81245ce1562539d89bc6e12584769739012325046b5e1c4e56febef108a7d2ae9ba
--
cgit v1.1
https://src.fedoraproject.org/cgit/perl-DBD-MySQL.git/commit/?h=f26&i...