summaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg
AgeCommit message (Collapse)Author
2014-02-17Translation updatesPeter Eisentraut
2014-02-17Prevent potential overruns of fixed-size buffers.Tom Lane
Coverity identified a number of places in which it couldn't prove that a string being copied into a fixed-size buffer would fit. We believe that most, perhaps all of these are in fact safe, or are copying data that is coming from a trusted source so that any overrun is not really a security issue. Nonetheless it seems prudent to forestall any risk by using strlcpy() and similar functions. Fixes by Peter Eisentraut and Jozef Mlich based on Coverity reports. In addition, fix a potential null-pointer-dereference crash in contrib/chkpass. The crypt(3) function is defined to return NULL on failure, but chkpass.c didn't check for that before using the result. The main practical case in which this could be an issue is if libc is configured to refuse to execute unapproved hashing algorithms (e.g., "FIPS mode"). This ideally should've been a separate commit, but since it touches code adjacent to one of the buffer overrun changes, I included it in this commit to avoid last-minute merge issues. This issue was reported by Honza Horak. Security: CVE-2014-0065 for buffer overruns, CVE-2014-0066 for crypt()
2014-02-17Fix handling of wide datetime input/output.Noah Misch
Many server functions use the MAXDATELEN constant to size a buffer for parsing or displaying a datetime value. It was much too small for the longest possible interval output and slightly too small for certain valid timestamp input, particularly input with a long timezone name. The long input was rejected needlessly; the long output caused interval_out() to overrun its buffer. ECPG's pgtypes library has a copy of the vulnerable functions, which bore the same vulnerabilities along with some of its own. In contrast to the server, certain long inputs caused stack overflow rather than failing cleanly. Back-patch to 8.4 (all supported versions). Reported by Daniel Schüssler, reviewed by Tom Lane. Security: CVE-2014-0063
2014-01-09Fix descriptor output in ECPG.Michael Meskes
While working on most platforms the old way sometimes created alignment problems. This should fix it. Also the regresion tests were updated to test for the reported case. Report and fix by MauMau <maumau307@gmail.com> Conflicts: src/interfaces/ecpg/preproc/type.c src/interfaces/ecpg/test/expected/sql-desc.c
2014-01-01Do not use an empty hostname.Michael Meskes
When trying to connect to a given database libecpg should not try using an empty hostname if no hostname was given.
2013-11-26ECPG: Make the preprocessor emit ';' if the variable type for a list ofMichael Meskes
variables is varchar. This fixes this test case: int main(void) { exec sql begin declare section; varchar a[50], b[50]; exec sql end declare section; return 0; } Since varchars are internally turned into custom structs and the type name is emitted for these variable declarations, the preprocessed code previously had: struct varchar_1 { ... } a _,_ struct varchar_2 { ... } b ; The comma in the generated C file was a syntax error. There are no regression test changes since it's not exercised. Patch by Boszormenyi Zoltan <zb@cybertec.at> Conflicts: src/interfaces/ecpg/preproc/ecpg.trailer
2013-11-26ECPG: Fix offset to NULL/size indicator array.Michael Meskes
Patch by Boszormenyi Zoltan <zb@cybertec.at>
2013-11-03Changed test case slightly so it doesn't have an unused typedef.Michael Meskes
2013-09-08Return error if allocation of new element was not possible.Michael Meskes
Found by Coverity.
2013-07-19Initialize day of year value.Michael Meskes
There are cases where the day of year value in struct tm is used, but it never got calculated. Problem found by Coverity scan.
2013-07-06Also escape double quotes for ECPG's #line statement.Michael Meskes
2013-07-05Applied patch by MauMau <maumau307@gmail.com> to escape filenames in #line ↵Michael Meskes
statements.
2013-03-04Fix overflow check in tm2timestamp (this time for sure).Tom Lane
I fixed this code back in commit 841b4a2d5, but didn't think carefully enough about the behavior near zero, which meant it improperly rejected 1999-12-31 24:00:00. Per report from Magnus Hagander.
2013-02-03Translation updatesPeter Eisentraut
2013-01-27Made ecpglib use translated messages.Michael Meskes
Bug reported and fixed by Chen Huajun <chenhj@cn.fujitsu.com>.
2012-11-29When processing nested structure pointer variables ecpg always expected anMichael Meskes
array datatype which of course is wrong. Applied patch by Muhammad Usama <m.usama@gmail.com> to fix this.
2012-08-14Translation updatesPeter Eisentraut
2012-05-31Translation updatesPeter Eisentraut
2012-02-23Translation updatesPeter Eisentraut
2011-12-18In ecpg removed old leftover check for given connection name.Michael Meskes
Ever since we introduced real prepared statements this should work for different connections. The old solution just emulating prepared statements, though, wasn't able to handle this. Closes: #6309
2011-12-01Translation updatesPeter Eisentraut
2011-09-22Translation updatesPeter Eisentraut
2011-09-08Add missing format argument to ecpg_log() callPeter Eisentraut
2011-09-02Fix brace indentation of commit a6d72ac344a8643142d76abe2c9d0b1ea68847fb to ↵Michael Meskes
fit PostgreSQL style.
2011-09-01In ecpglib restore LC_NUMERIC in case of an error.Michael Meskes
2011-07-18Adapted expected result for latest change to ecpglib.Michael Meskes
2011-07-18Made ecpglib write double with a precision of 15 digits.Michael Meskes
Patch by Akira Kurosawa <kurosawa-akira@mxc.nes.nec.co.jp>.
2011-06-14Fix assorted issues with build and install paths containing spaces.Tom Lane
Apparently there is no buildfarm critter exercising this case after all, because it fails in several places. With this patch, build, install, check-world, and installcheck-world pass for me on OS X.
2011-02-15Add CheckTableNotInUse calls in DROP TABLE and DROP INDEX.Tom Lane
Recent releases had a check on rel->rd_refcnt in heap_drop_with_catalog, but failed to cover the possibility of pending trigger events at DROP time. (Before 8.4 we didn't even check the refcnt.) When the trigger events were eventually fired, you'd get "could not open relation with OID nnn" errors, as in recent report from strk. Better to throw a suitable error when the DROP is attempted. Also add a similar check in DROP INDEX. Back-patch to all supported branches.
2010-12-24Allow vpath builds and regression tests to succeed on Mingw. Backpatch to ↵Andrew Dunstan
release 8.4 - earlier releases would require more changes and it's not worth the trouble.
2010-12-13Translation updates for release 8.4.6Peter Eisentraut
2010-10-20Fix ecpg test building process to not generate *.dSYM junk on Macs.Tom Lane
The trick is to not try to build executables directly from .c files, but to always build the intermediate .o files. For obscure reasons, Darwin's version of gcc will leave debug cruft behind in the first case but not the second. Per complaint from Robert Haas.
2010-10-14Applied patch by Itagaki Takahiro to fix incorrect status calculation inMichael Meskes
ecpglib. Instead of parsing the statement just as ask the database server.
2010-09-30Translation updates for 8.4.5Peter Eisentraut
2010-09-24Still more .gitignore cleanup.Tom Lane
Fix overly-enthusiastic ignores, as identified by git ls-files -i --exclude-standard
2010-09-22Add gitignore files for ecpg regression tests.Magnus Hagander
Backpatch to 8.2 as that's how far the structure looks the same.
2010-09-22Convert cvsignore to gitignore, and add .gitignore for build targets.Magnus Hagander
2010-08-17Applied Zoltan's patch to fix a few memleaks in ecpg's pgtypeslib.Michael Meskes
2010-06-04Data returned by RETURNING clause wasn't correctly processed by ecpg. Patch ↵Michael Meskes
backported from HEAD.
2010-05-13Translation updatePeter Eisentraut
2010-05-07ECPG connect routine only checked for NULL to find empty parameters, but ↵Michael Meskes
user and password can also be "".
2010-03-08Backport fix from HEAD that makes ecpglib give the right SQLSTATE if the ↵Michael Meskes
connection disappears.
2010-01-08Backported fix for protecting ecpg against applications freeing strings to 8.4.Michael Meskes
2009-11-27Remove */ characters from declare cursor statements before putting them into aMichael Meskes
comment.
2009-11-21Refactor ecpg grammar so that it uses the core grammar's unreserved_keywordTom Lane
list, minus a few specific words that have to be treated specially. This replaces a hard-wired list of keywords that would have needed manual maintenance, and was not getting it. The 8.4 coding was already missing these words, causing ecpg to incorrectly treat them as reserved words: CALLED, CATALOG, DEFINER, ENUM, FOLLOWING, INVOKER, OPTIONS, PARTITION, PRECEDING, RANGE, SECURITY, SERVER, UNBOUNDED, WRAPPER. In HEAD we were additionally missing COMMENTS, FUNCTIONS, SEQUENCES, TABLES. Per gripe from Bosco Rama.
2009-09-08Remove outside-the-scanner references to "yyleng".Tom Lane
It seems the flex developers have decided to change yyleng from int to size_t. This has already happened in the latest release of OS X, and will start happening elsewhere once the next release of flex appears. Rather than trying to divine how it's declared in any particular build, let's just remove the one existing not-very-necessary external usage. Back-patch to all supported branches; not so much because users in the field are likely to care about building old branches with cutting-edge flex, as to keep OSX-based buildfarm members from having problems with old branches.
2009-09-03Translation updatesPeter Eisentraut
2009-07-22Fix mismatch in const:ness of parameters.Magnus Hagander
2009-06-26Translation updates for 8.4 release.Peter Eisentraut
File that are translated less than 80% have been removed, as per new translation team policy.
2009-06-118.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef listBruce Momjian
provided by Andrew.