Commit Graph

42 Commits

Author SHA1 Message Date
Noah Misch 4318daecc9 Fix handling of wide datetime input/output.
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-02-17 09:33:31 -05:00
Bruce Momjian 9af4159fce pgindent run for release 9.3
This is the first run of the Perl-based pgindent script.  Also update
pgindent instructions.
2013-05-29 16:58:43 -04:00
Michael Meskes 59e242a496 Mark variables as const in pgtypeslib if they only carry a format string. 2011-12-18 19:04:19 +01:00
Magnus Hagander 9f2e211386 Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
Bruce Momjian d747140279 8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef list
provided by Andrew.
2009-06-11 14:49:15 +00:00
Michael Meskes 14f29f640a Removed unsigned/signed mismatches. 2009-05-20 16:49:23 +00:00
Michael Meskes 0754b391f3 Removed some unneeded variables and comparisons 2009-05-20 16:13:18 +00:00
Michael Meskes 649a1252b7 Added result checks for calls to gmtime(). 2009-02-04 08:51:10 +00:00
Bruce Momjian fdf5a5efb7 pgindent run for 8.3. 2007-11-15 21:14:46 +00:00
Michael Meskes 635a0b9a86 - Finished major rewrite to use new protocol version
- Really prepare statements
- Added more regression tests
- Added auto-prepare mode
- Use '$n' for positional variables, '?' is still possible via ecpg option
- Cleaned up the sources a little bit
2007-08-14 10:01:54 +00:00
Bruce Momjian f99a569a2e pgindent run for 8.2. 2006-10-04 00:30:14 +00:00
Michael Meskes 0f0d6765ce Added missing constuctor/destructor for interval and date. 2006-09-14 08:02:38 +00:00
Michael Meskes b30da7ba5f Added lots of SoC stuff made by Joachim.
Fixed broken newline on Windows.
Fixed a nasty buffer underrun that only occured when using Informix
no_indicator NULL setting on timestamps and intervals.
2006-08-15 06:40:20 +00:00
Michael Meskes a829da152c Added fixed from the coverity report send in by Joachim Wieland <joe@mcknight.de>
Added missing error handling in a few functions in ecpglib
2006-06-21 10:24:41 +00:00
Michael Meskes 085e7c2fd8 Somehow a ";" got lost which changed the logic. This btw is the first fix resulting from SoC. 2006-05-31 08:12:48 +00:00
Bruce Momjian f3d99d160d Add CVS tag lines to files that were lacking them. 2006-03-11 04:38:42 +00:00
Bruce Momjian 436a2956d8 Re-run pgindent, fixing a problem where comment lines after a blank
comment line where output as too long, and update typedefs for /lib
directory.  Also fix case where identifiers were used as variable names
in the backend, but as typedefs in ecpg (favor the backend for
indenting).

Backpatch to 8.1.X.
2005-11-22 18:17:34 +00:00
Bruce Momjian 1dc3498251 Standard pgindent run for 8.1. 2005-10-15 02:49:52 +00:00
Tom Lane 303e089df5 Clean up possibly-uninitialized-variable warnings reported by gcc 4.x. 2005-09-24 22:54:44 +00:00
Bruce Momjian a536b2dd80 Add time/date macros for code clarity:
#define DAYS_PER_YEAR   365.25
	#define MONTHS_PER_YEAR 12
	#define DAYS_PER_MONTH  30
	#define HOURS_PER_DAY   24
2005-07-21 03:56:25 +00:00
Bruce Momjian 09ff9dbe2b Remove more extraneous parentheses in date/time functions. 2005-05-24 02:09:45 +00:00
Bruce Momjian 4550c1e519 More macro cleanups for date/time. 2005-05-23 21:54:02 +00:00
Bruce Momjian 15d3f9f6b7 Another pgindent run with lib typedefs added. 2004-08-30 02:54:42 +00:00
Bruce Momjian b6b71b85bc Pgindent run for 8.0. 2004-08-29 05:07:03 +00:00
Tom Lane 0bd61548ab Solve the 'Turkish problem' with undesirable locale behavior for case
conversion of basic ASCII letters.  Remove all uses of strcasecmp and
strncasecmp in favor of new functions pg_strcasecmp and pg_strncasecmp;
remove most but not all direct uses of toupper and tolower in favor of
pg_toupper and pg_tolower.  These functions use the same notions of
case folding already developed for identifier case conversion.  I left
the straight locale-based folding in place for situations where we are
just manipulating user data and not trying to match it to built-in
strings --- for example, the SQL upper() function is still locale
dependent.  Perhaps this will prove not to be what's wanted, but at
the moment we can initdb and pass regression tests in Turkish locale.
2004-05-07 00:24:59 +00:00
Tom Lane 4351f8823d Fix portability bugs: char values passed to <ctype.h> functions must
be cast to unsigned char.  We have learned this the hard way before.
2004-01-04 04:17:01 +00:00
Peter Eisentraut 06e6aa236c Add missing include file. 2003-10-07 08:07:56 +00:00
Michael Meskes 3cda980298 Fixed error handling in Informix compat str to date conversion. 2003-10-07 05:46:56 +00:00
Michael Meskes 8e6b74e4fd Fixed bug in day of week processing. 2003-10-05 11:12:00 +00:00
Michael Meskes fcdf0e22fc - Added Dave patch for Informix handling of numeric/int conversion.
- Changed all new datatypes to lowercase.
- Fixed rounding bug in numerical types.
2003-09-09 10:46:42 +00:00
Bruce Momjian 089003fb46 pgindent run. 2003-08-04 00:43:34 +00:00
Michael Meskes 7a9c074cba - Added some Informix error codes in Informix mode.
- Added just another pgtypeslib function.
2003-08-01 08:21:04 +00:00
Michael Meskes 060229b9d7 Fixed mdy functions to use correct offset. 2003-07-24 08:41:07 +00:00
Michael Meskes 7d32551a81 Fixed some bugs in Informix compat functions. 2003-07-17 07:54:29 +00:00
Michael Meskes c7fddd3072 date, interval and timestamp data should be quoted. 2003-07-04 12:00:52 +00:00
Michael Meskes 7b1885bf98 Fixed initialization bug and added postgres_fe.h to pgtypeslib. 2003-07-02 07:57:36 +00:00
Michael Meskes 6f30d5665c The remaining files ... 2003-06-25 17:55:50 +00:00
Michael Meskes a50f285d8d Added some more informix compatibility functions. 2003-04-08 12:34:25 +00:00
Michael Meskes 7b85b730f5 More patches for informix compatibility. 2003-04-01 14:37:25 +00:00
Michael Meskes 999f12982e Moved Informix stuff to its own compat library. Interval datetype is now fully functional. 2003-03-30 11:48:19 +00:00
Michael Meskes 524e9d62a7 Changes to the parser to accept new datatypes. 2003-03-21 14:17:47 +00:00
Michael Meskes 2e6f97560a Started adding date and timestamp. 2003-03-20 15:56:50 +00:00