Holger Hans Peter Freyther | 0eafd56 | 2014-04-08 19:43:14 +0200 | [diff] [blame] | 1 | This is a backport of a fix from Holger Freyther to the |
| 2 | libdbd sqlite3 driver. |
| 3 | |
| 4 | Index: libdbi-drivers-0.8.3-1/drivers/sqlite3/dbd_sqlite3.c |
| 5 | =================================================================== |
| 6 | --- libdbi-drivers-0.8.3-1.orig/drivers/sqlite3/dbd_sqlite3.c |
| 7 | +++ libdbi-drivers-0.8.3-1/drivers/sqlite3/dbd_sqlite3.c |
| 8 | @@ -502,7 +502,8 @@ size_t dbd_quote_binary(dbi_conn_t *conn |
| 9 | unsigned char *temp; |
| 10 | size_t len; |
| 11 | |
| 12 | - if ((temp = malloc(from_length*2)) == NULL) { |
| 13 | + /* allocate an extra byte for NULL and two for the quotes */ |
| 14 | + if ((temp = malloc(2*from_length+1+2)) == NULL) { |
| 15 | return 0; |
| 16 | } |
| 17 | |