MINGW-packages/mingw-w64-lmdb/002-fix-stack-allocated-string.patch
2023-05-10 18:02:34 +05:30

21 lines
644 B
Diff

diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c
--- a/libraries/liblmdb/mdb.c
+++ b/libraries/liblmdb/mdb.c
@@ -1735,13 +1735,10 @@
mdb_strerror(int err)
{
#ifdef _WIN32
- /** HACK: pad 4KB on stack over the buf. Return system msgs in buf.
- * This works as long as no function between the call to mdb_strerror
- * and the actual use of the message uses more than 4K of stack.
- */
+ // Avoid potential issue with stack-allocated string by using static variable
#define MSGSIZE 1024
-#define PADSIZE 4096
- char buf[MSGSIZE+PADSIZE], *ptr = buf;
+ static char buf[MSGSIZE];
+ char *ptr = buf;
#endif
int i;
if (!err)