Unverified Commit 3f559f01 authored by Weijia Wang's avatar Weijia Wang Committed by GitHub
Browse files

Merge pull request #296541 from StephenWithPH/fix-gnucash-crash

libdbiDrivers: take upstream patch to prevent Gnucash buffer overflow triggered by glibc 2.38 fortification
parents c2b74253 36791295
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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;
  '';
@@ -41,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 = ''
+11 −0
Original line number Diff line number Diff line
--- 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;