postgresql/src
Tom Lane 01824385ae Prevent potential overruns of fixed-size buffers.
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-17 11:20:21 -05:00
..
backend Prevent potential overruns of fixed-size buffers. 2014-02-17 11:20:21 -05:00
bin Prevent potential overruns of fixed-size buffers. 2014-02-17 11:20:21 -05:00
common Prevent potential overruns of fixed-size buffers. 2014-02-17 11:20:21 -05:00
include Predict integer overflow to avoid buffer overruns. 2014-02-17 09:33:31 -05:00
interfaces Prevent potential overruns of fixed-size buffers. 2014-02-17 11:20:21 -05:00
makefiles Flush a stray definition of $(DLLTOOL). 2014-02-11 12:59:48 -05:00
pl Prevent privilege escalation in explicit calls to PL validators. 2014-02-17 09:33:31 -05:00
port Fix unportable coding in tarCreateHeader(). 2014-02-16 20:01:18 -05:00
template Revert to using --enable-auto-import in Cygwin builds. 2014-02-16 15:14:04 -05:00
test Prevent potential overruns of fixed-size buffers. 2014-02-17 11:20:21 -05:00
timezone Prevent potential overruns of fixed-size buffers. 2014-02-17 11:20:21 -05:00
tools Rename 'gmake' to 'make' in docs and recommended commands 2014-02-12 17:29:19 -05:00
tutorial Rename 'gmake' to 'make' in docs and recommended commands 2014-02-12 17:29:19 -05:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Create libpgcommon, and move pg_malloc et al to it 2013-02-12 11:21:05 -03:00
Makefile.global.in Cygwin build fixes. 2014-02-11 12:10:52 -05:00
Makefile.shlib Tweak position of $(DLL_DEFFILE) in shared-library link commands. 2014-02-12 11:22:23 -05:00
bcc32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
nls-global.mk Remove maintainer-check target, fold into normal build 2013-10-10 20:11:56 -04:00
win32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00