Commit Graph

822 Commits

Author SHA1 Message Date
Evan Miller
1b96ef4b0d Clarify mdb_unicode2ascii API and fix buffer overrun (#220)
There was some confusion as to whether the destination buffer length
should include space for the null terminator. Some callers of the
function assumed that a terminator would be added beyond the end
of the stated buffer size, while others did not. Make everything
consistent and also fix an overrun when there was insufficient
space for the output in the non-iconv implementation.

As stated in a code comment, a better solution would follow the lead
of libxls and use wcstombs and friends when iconv is not available.
But this gets into the weeds with conversion functions named differently
across platforms. The goal here is to fix the buffer overrun.

See oss-fuzz/28773
2020-12-19 08:24:32 -05:00
Evan Miller
7ce75142e8 Merge pull request #219 from evanmiller/oss-fuzz-28790
Fix integer overflow
2020-12-18 19:51:59 -05:00
Evan Miller
50c9bdfee6 Fix buffer overflow (#218)
See oss-fuzz/28787
2020-12-18 19:42:11 -05:00
Evan Miller
78bbf4250e Merge pull request #217 from evanmiller/oss-fuzz-28780
Fix stack overflow
2020-12-18 16:35:48 -05:00
Evan Miller
16d249748a Fix integer overflow
See oss-fuzz/28790
2020-12-18 11:22:52 -05:00
Evan Miller
89007cba18 Fix stack overflow
See oss-fuzz/28780
2020-12-18 09:35:12 -05:00
Evan Miller
a1cda27a58 Null-terminate binary strings
See oss-fuzz/28779
2020-12-18 09:26:28 -05:00
Evan Miller
e7d5125e2b Fix libmdbsql build on Windows 2020-12-17 11:04:54 -05:00
Evan Miller
cd7ced0da0 Remove mem.c from Makefile 2020-11-27 06:02:26 -05:00
Evan Miller
eb39a483a3 Remove long-deprecated functions
mdb_init() and mdb_exit() have done nothing for a while.

mdb_get_coltype_string() and mdb_coltype_takes_length() were previously
removed, but remained in the header file by accident.
2020-11-27 05:58:14 -05:00
Nirgal Vourgère
cc15473d71 Deprecate mdb-array mdb-header mdb-parsecsv 2020-11-25 12:14:45 +01:00
Evan Miller
1efe8fc709 Merge pull request #194 from evanmiller/bounds-check-mdb-sql-bind-column
[Updated] Bounds check mdb_sql_bind_column()
2020-11-14 08:16:53 -05:00
Evan Miller
5f55b259de Merge pull request #195 from evanmiller/thread-safety
Use re-entrant functions and thread-local storage in a couple of places
2020-11-12 16:14:15 -05:00
Evan Miller
df48fcb284 Use thread-local storage to cache run-time options 2020-11-12 13:38:32 -05:00
Evan Miller
1bef1b1dca Use re-entrant functions in a couple of places
Replace strtok and gmtime with their re-entrant versions. More to come.
2020-11-12 11:20:05 -05:00
Evan Miller
12de22459a Fix indentation warning on GCC 2020-11-08 09:39:59 -05:00
Evan Miller
cdc0d184f2 Fix syntax error 2020-11-08 09:25:26 -05:00
Evan Miller
514e0fded0 Merge pull request #185 from mjwoodcock/odbc-string-truncation
Don't include length of '\0' in SQLGetData pcbValue
2020-11-08 09:19:28 -05:00
Evan Miller
bbc53dfade Bounds check mdb_sql_bind_column()
Return -1 if the bounds check fails, otherwise the result of
mdb_bind_column_by_name.

Update other places in the code to check the return value.
2020-11-08 08:50:17 -05:00
Evan Miller
38ce7db045 Large file support on 32-bit systems
* Add AC_SYS_LARGEFILE to configure.ac

* Replace fseek with fseeko
2020-11-07 11:40:44 -05:00
Evan Miller
ad14a04dfa Merge pull request #192 from evanmiller/merge-166
Original author: @rogerswb 

* Dynamic allocation of MdbSQL->bound_values 

Was previously hardcoded to 256 columns max.
2020-11-01 08:31:50 -05:00
James Woodcock
42996dad65 Send error message to stderr 2020-11-01 12:56:38 +00:00
Evan Miller
8b7162ded3 Merge branch 'dev' of github.com:mdbtools/mdbtools into merge-166 2020-11-01 07:55:53 -05:00
James Woodcock
de4f5516b7 Handle errors from mdb_bind_column() 2020-10-31 09:46:00 +00:00
James Woodcock
50f1bd4a86 Return column number from mdb_bind_column()
To match the return from mdb_bind_column_by_name().
2020-10-31 09:40:24 +00:00
James Woodcock
2e8480d7e5 Merge branch 'dev' of https://github.com/mdbtools/mdbtools into bounds-check-mdb-bind-column 2020-10-31 09:38:03 +00:00
Nirgal Vourgère
9e50c7401d Modernize bash-completion
Use _init_completion
Support long options with or without =
Auto generate options from the --help using _parse_help
2020-10-27 00:05:26 +01:00
nirgal
58f240ac6f Added back -q support 2020-10-25 20:49:20 +00:00
Nirgal Vourgère
f6053aa211 Quote shell special characters ...
... and add support for mdb-count mdb-json and mdb-queries
2020-10-25 20:19:39 +01:00
Nirgal Vourgère
c7d527fdeb mdb-export: Rename --backend into --insert 2020-10-25 12:09:51 +01:00
Nirgal Vourgère
ea478f3bc6 mdb-export: reorder options, man, bash-completion 2020-10-25 11:24:28 +01:00
Rainer Hurling
5b292e0063 Unsigned error in index.c
On FreeBSD 13.0-CURRENT its compiler clang-11.0.0 complains:
index.c:388:14: error: comparison of integers of different signs: 'int' and 'unsigned int' [-Werror,-Wsign-compare]
                for (i=0; i<len+1; i++) {
                          ~^~~~~~
2020-10-24 20:29:46 +02:00
James Woodcock
a7885f2680 Bounds check mdb_bind_column()
Return -1 to report out of bounds column number.
2020-10-24 13:27:34 +01:00
James Woodcock
06868e58ae Don't include length of '\0' in SQLGetData pcbValue
SQLGetData() should return the length of the string without the
null terminator.
2020-10-24 09:47:10 +01:00
James Woodcock
9bf70e0e1e mdb-export: use sensible date formats 2020-10-24 09:41:39 +01:00
Nirgal Vourgère
d0d95f6503 Install bash-completion snippets by default
Added autoconf --with-bash-completion-dir and --without-bash-completion-dir options
2020-10-23 18:58:45 +02:00
Nirgal Vourgère
f192c258ab bash-completion: get rid of "have" calls
have function disappeared in bash-completion 1.90 (2011)
2020-10-23 14:05:50 +02:00
Evan Miller
131b443102 Do not exit from library 2020-10-18 09:45:51 -04:00
Evan Miller
d8ed91bb05 Include missing header files in make dist 2020-10-18 07:59:45 -04:00
nirgal
6a41020538 Spelling typo 2020-10-18 08:59:36 +00:00
Nyall Dawson
3ac497c6ff Fix crash when a missing file is accessed via ODBC 2020-10-12 13:47:11 +10:00
Evan Miller
a051350ba1 make distcheck fixes 2020-10-11 15:46:19 -04:00
Evan Miller
c19654ad40 Remove gmdb2
Split off the Gnome MDB file viewer into its own project:

    https://github.com/mdbtools/gmdb2

This simplifies the build process somewhat and lets us focus on the core
project. (For starters, no more -Wno-portability flag!)
2020-10-11 14:59:08 -04:00
James Woodcock
eb5dd4d0b7 Support "SELECT TOP n [PERCENT]... " queries.
Updated the SQL parser to support "SELECT TOP n [PERCENT]... " queries,
matching the Mocrosoft Access SQL language.

Export these queries from databases with mdb-queries.
2020-09-26 11:28:34 +01:00
Evan Miller
9d0c40905d Merge branch 'dev' of github.com:mdbtools/mdbtools 2020-09-19 14:01:23 -04:00
James Woodcock
833985043f mdb-sql: Simplify handling files loaded by ":r"
:r is an undocumented command to load SQL files from the msb-sql prompt
2020-09-19 11:29:41 +01:00
James Woodcock
eab60a6060 mdb-sql: Handle ';' as terminators in SQL input files 2020-09-19 11:28:44 +01:00
James Woodcock
9c8b67b8f8 mdb-sql: support ';' as an SQL terminator 2020-09-19 11:28:00 +01:00
Evan Miller
9f41e03278 Fix up libtool version-info logic 2020-09-05 10:50:24 -04:00
Evan Miller
6e08ad5ae9 Add copyright info for fakeglib 2020-09-05 10:49:56 -04:00