From c82b8ad1d01f43c6c9e73ffe147001d3b6d05b79 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Sat, 17 Jun 2023 02:54:03 +0200 Subject: [PATCH] add missing patch --- notwa-util/zipfile-unfuckery.patch | 61 ++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 notwa-util/zipfile-unfuckery.patch diff --git a/notwa-util/zipfile-unfuckery.patch b/notwa-util/zipfile-unfuckery.patch new file mode 100644 index 0000000..267c3d9 --- /dev/null +++ b/notwa-util/zipfile-unfuckery.patch @@ -0,0 +1,61 @@ +diff -rU3 a/third_party/sqlite3/zipfile.c b/third_party/sqlite3/zipfile.c +--- a/third_party/sqlite3/zipfile.c 2023-06-13 01:39:06.538998700 +0200 ++++ b/third_party/sqlite3/zipfile.c 2023-06-13 01:40:24.578767300 +0200 +@@ -338,7 +338,7 @@ + + if( argc>3 ){ + zFile = argv[3]; +- nFile = (int)strlen(zFile)+1; ++ nFile = (int)strnlen(zFile,0x7FFFFFFF)+1; + } + + rc = sqlite3_declare_vtab(db, ZIPFILE_SCHEMA); +@@ -1421,10 +1421,10 @@ + ** nB is the value of strlen(zB). This function returns 0 if the strings are + ** identical, ignoring any trailing '/' character in either path. */ + static int zipfileComparePath(const char *zA, const char *zB, int nB){ +- int nA = (int)strlen(zA); ++ int nA = (int)strnlen(zA,0x7FFFFFFF); + if( nA>0 && zA[nA-1]=='/' ) nA--; + if( nB>0 && zB[nB-1]=='/' ) nB--; +- if( nA==nB && memcmp(zA, zB, nA)==0 ) return 0; ++ if( nA==nB && memcmp(zA, zB, (unsigned int)nA)==0 ) return 0; + return 1; + } + +@@ -1544,7 +1544,7 @@ + /* If this is a DELETE or UPDATE, find the archive entry to delete. */ + if( sqlite3_value_type(apVal[0])!=SQLITE_NULL ){ + const char *zDelete = (const char*)sqlite3_value_text(apVal[0]); +- int nDelete = (int)strlen(zDelete); ++ int nDelete = (int)strnlen(zDelete,0x7FFFFFFF); + if( nVal>1 ){ + const char *zUpdate = (const char*)sqlite3_value_text(apVal[1]); + if( zUpdate && zipfileComparePath(zUpdate, zDelete, nDelete)!=0 ){ +@@ -1612,7 +1612,7 @@ + if( rc==SQLITE_OK ){ + zPath = (const char*)sqlite3_value_text(apVal[2]); + if( zPath==0 ) zPath = ""; +- nPath = (int)strlen(zPath); ++ nPath = (int)strnlen(zPath,0x7FFFFFFF); + mTime = zipfileGetTime(apVal[4]); + } + +@@ -1628,7 +1628,7 @@ + rc = SQLITE_NOMEM; + nPath = 0; + }else{ +- nPath = (int)strlen(zPath); ++ nPath = (int)strnlen(zPath,0x7FFFFFFF); + } + } + } +@@ -2034,7 +2034,7 @@ + rc = SQLITE_NOMEM; + goto zipfile_step_out; + } +- nName = (int)strlen(zName); ++ nName = (int)strnlen(zName,0x7FFFFFFF); + }else{ + while( nName>1 && zName[nName-2]=='/' ) nName--; + }