aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoward Chu <hyc@symas.com>2016-01-27 01:53:29 +0000
committerHoward Chu <hyc@symas.com>2016-01-27 14:14:11 +0000
commit3ca6e853f6206c851485f2d44bc68694d13a8b60 (patch)
treeddc9c6ecb3a2ceb5c8153ddab59be3e41d669cc8
parentMDB_VL32 Fix d2a5f72f73e0e4030b521086b13b8c8efaf9ca9e (diff)
downloadmonero-3ca6e853f6206c851485f2d44bc68694d13a8b60.tar.xz
Tweak mdb_strerror msg buffer
-rw-r--r--external/db_drivers/liblmdb/mdb.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/external/db_drivers/liblmdb/mdb.c b/external/db_drivers/liblmdb/mdb.c
index 5efd74091..2ce2614f6 100644
--- a/external/db_drivers/liblmdb/mdb.c
+++ b/external/db_drivers/liblmdb/mdb.c
@@ -1572,8 +1572,9 @@ mdb_strerror(int err)
* 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.
*/
- char pad[4096];
- char buf[1024], *ptr = buf;
+#define MSGSIZE 1024
+#define PADSIZE 4096
+ char buf[MSGSIZE+PADSIZE], *ptr = buf;
#endif
int i;
if (!err)
@@ -1605,7 +1606,7 @@ mdb_strerror(int err)
buf[0] = 0;
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, err, 0, ptr, sizeof(buf), (va_list *)pad);
+ NULL, err, 0, ptr, MSGSIZE, (va_list *)buf+MSGSIZE);
return ptr;
#else
return strerror(err);