From 88801dab5eff529e79f066a7bb230842b876ccb1 Mon Sep 17 00:00:00 2001 From: StephenWithPH Date: Sat, 16 Mar 2024 17:32:17 -0700 Subject: [PATCH 1/2] libdbiDrivers: take upstream patch to prevent buffer overflow triggered by glibc 2.38 fortification --- pkgs/development/libraries/libdbi-drivers/default.nix | 5 +++++ .../libdbi-drivers-0.9.0-buffer_overflow.patch | 11 +++++++++++ 2 files changed, 16 insertions(+) create mode 100644 pkgs/development/libraries/libdbi-drivers/libdbi-drivers-0.9.0-buffer_overflow.patch diff --git a/pkgs/development/libraries/libdbi-drivers/default.nix b/pkgs/development/libraries/libdbi-drivers/default.nix index 461a3c0b7bbd..04ff250e4812 100644 --- a/pkgs/development/libraries/libdbi-drivers/default.nix +++ b/pkgs/development/libraries/libdbi-drivers/default.nix @@ -16,6 +16,11 @@ stdenv.mkDerivation rec { buildInputs = [ libdbi sqlite postgresql ] ++ lib.optional (libmysqlclient != null) libmysqlclient; + patches = [ + # https://sourceforge.net/p/libdbi-drivers/libdbi-drivers/ci/24f48b86c8988ee3aaebc5f303d71e9d789f77b6 + ./libdbi-drivers-0.9.0-buffer_overflow.patch + ]; + postPatch = '' sed -i '/SQLITE3_LIBS/ s/-lsqlite/-lsqlite3/' configure; ''; diff --git a/pkgs/development/libraries/libdbi-drivers/libdbi-drivers-0.9.0-buffer_overflow.patch b/pkgs/development/libraries/libdbi-drivers/libdbi-drivers-0.9.0-buffer_overflow.patch new file mode 100644 index 000000000000..1891c1a143ba --- /dev/null +++ b/pkgs/development/libraries/libdbi-drivers/libdbi-drivers-0.9.0-buffer_overflow.patch @@ -0,0 +1,11 @@ +--- a/drivers/sqlite3/dbd_sqlite3.c ++++ b/drivers/sqlite3/dbd_sqlite3.c +@@ -1451,7 +1451,7 @@ static int getTables(char** tables, int + break; + } + +- word_lower[item-start+1]; ++ char word_lower[item-start+1]; + strncpy(word_lower,start,item-start); + word_lower[item-start] = '\0'; + int i = 0; From 367912953c382ed11b5e4d94145e8206d9a20274 Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Thu, 21 Mar 2024 10:00:46 +0100 Subject: [PATCH 2/2] libdbiDrivers: fix build with clang --- pkgs/development/libraries/libdbi-drivers/default.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/development/libraries/libdbi-drivers/default.nix b/pkgs/development/libraries/libdbi-drivers/default.nix index 04ff250e4812..f1352cd47b92 100644 --- a/pkgs/development/libraries/libdbi-drivers/default.nix +++ b/pkgs/development/libraries/libdbi-drivers/default.nix @@ -46,6 +46,11 @@ stdenv.mkDerivation rec { "--with-pgsql_libdir=${postgresql.lib}/lib" ]; + env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.cc.isClang [ + "-Wno-error=incompatible-function-pointer-types" + "-Wno-error=int-conversion" + ]); + installFlags = [ "DESTDIR=\${out}" ]; postInstall = ''