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

libdbiDrivers: take upstream patch to prevent Gnucash buffer overflow triggered by glibc 2.38 fortification
This commit is contained in:
Weijia Wang 2024-03-21 11:35:11 +01:00 committed by GitHub
commit 3f559f01aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 0 deletions

View file

@ -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 = ''

View file

@ -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;