postgresql/src/interfaces/ecpg/test
Tom Lane 586dd5d6a5 Replace a bunch more uses of strncpy() with safer coding.
strncpy() has a well-deserved reputation for being unsafe, so make an
effort to get rid of nearly all occurrences in HEAD.

A large fraction of the remaining uses were passing length less than or
equal to the known strlen() of the source, in which case no null-padding
can occur and the behavior is equivalent to memcpy(), though doubtless
slower and certainly harder to reason about.  So just use memcpy() in
these cases.

In other cases, use either StrNCpy() or strlcpy() as appropriate (depending
on whether padding to the full length of the destination buffer seems
useful).

I left a few strncpy() calls alone in the src/timezone/ code, to keep it
in sync with upstream (the IANA tzcode distribution).  There are also a
few such calls in ecpg that could possibly do with more analysis.

AFAICT, none of these changes are more than cosmetic, except for the four
occurrences in fe-secure-openssl.c, which are in fact buggy: an overlength
source leads to a non-null-terminated destination buffer and ensuing
misbehavior.  These don't seem like security issues, first because no stack
clobber is possible and second because if your values of sslcert etc are
coming from untrusted sources then you've got problems way worse than this.
Still, it's undesirable to have unpredictable behavior for overlength
inputs, so back-patch those four changes to all active branches.
2015-01-24 13:05:42 -05:00
..
compat_informix Fix missing dependencies in ecpg's test Makefiles. 2014-05-08 22:34:51 -04:00
connect Let installcheck-world pass against a server requiring a password. 2014-06-19 21:41:26 -04:00
expected Let installcheck-world pass against a server requiring a password. 2014-06-19 21:41:26 -04:00
performance Hopefully that's it. The remaining files for ecpg regression tests. 2006-08-02 14:14:04 +00:00
pgtypeslib Un-break ecpg test suite under --disable-integer-datetimes. 2014-05-08 19:29:02 -04:00
preproc Fix missing dependencies in ecpg's test Makefiles. 2014-05-08 22:34:51 -04:00
sql Fix missing dependencies in ecpg's test Makefiles. 2014-05-08 22:34:51 -04:00
thread Still more .gitignore cleanup. 2010-09-24 13:48:15 -04:00
.gitignore Still more .gitignore cleanup. 2010-09-24 13:48:15 -04:00
ecpg_schedule Several fixes to array handling in ecpg. 2014-04-09 11:23:38 +02:00
ecpg_schedule_tcp Remove extra newlines at end and beginning of files, add missing newlines 2010-08-19 05:57:36 +00:00
Makefile Finish adding file version information to installed Windows binaries. 2014-08-18 22:59:53 -04:00
Makefile.regress Make ECPG test programs depend on "ecpg$(X)", not "ecpg". 2014-11-02 21:43:25 -05:00
pg_regress_ecpg.c Replace a bunch more uses of strncpy() with safer coding. 2015-01-24 13:05:42 -05:00
regression.h fix ecpg regression tests broken by over-eager adding of $PostgreSQL$ markers 2008-05-17 02:43:16 +00:00
resultmap Enable compiling with the mingw-w64 32 bit compiler. 2011-12-10 15:35:41 -05:00