summaryrefslogtreecommitdiff
path: root/dev-db/libdbi-drivers/files/libdbi-drivers-0.9.0-buffer-overflow-sqlite.patch
blob: 3bec6d958bc6bc285b178ced06e91b84a8770e62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
https://bugs.gentoo.org/933427
https://sourceforge.net/p/libdbi-drivers/libdbi-drivers/ci/7657c4c688c021d5f42a38e998c876d1739d5d8f
--- a/drivers/sqlite3/dbd_sqlite3.c
+++ b/drivers/sqlite3/dbd_sqlite3.c
@@ -585,7 +585,8 @@
   unsigned char *temp;
   size_t len;
 
-  if ((temp = malloc(from_length*2)) == NULL) {
+  /* allocate an extra byte for NULL and two for the quotes */
+  if ((temp = malloc(2*from_length+1+2)) == NULL) {
     return 0;
   }