postgresql/src/include
Tom Lane e92c67ddc0 Fix off-by-one loop count in MapArrayTypeName, and get rid of static array.
MapArrayTypeName would copy up to NAMEDATALEN-1 bytes of the base type
name, which of course is wrong: after prepending '_' there is only room for
NAMEDATALEN-2 bytes.  Aside from being the wrong result, this case would
lead to overrunning the statically allocated work buffer.  This would be a
security bug if the function were ever used outside bootstrap mode, but it
isn't, at least not in any currently supported branches.

Aside from fixing the off-by-one loop logic, this patch gets rid of the
static work buffer by having MapArrayTypeName pstrdup its result; the sole
caller was already doing that, so this just requires moving the pstrdup
call.  This saves a few bytes but mainly it makes the API a lot cleaner.

Back-patch on the off chance that there is some third-party code using
MapArrayTypeName with less-secure input.  Pushing pstrdup into the function
should not cause any serious problems for such hypothetical code; at worst
there might be a short term memory leak.

Per Coverity scanning.
2014-12-16 15:35:43 -05:00
..
access Flush unlogged table's buffers when copying or moving databases. 2014-10-20 23:47:00 +02:00
bootstrap Fix off-by-one loop count in MapArrayTypeName, and get rid of static array. 2014-12-16 15:35:43 -05:00
catalog Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
commands Test IsInTransactionChain, not IsTransactionBlock, in vac_update_relstats. 2014-10-30 13:03:31 -04:00
datatype Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
executor Ensure that whole-row Vars produce nonempty column names. 2014-11-10 15:21:26 -05:00
foreign Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
lib Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
libpq Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
mb Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
nodes Ensure that whole-row Vars produce nonempty column names. 2014-11-10 15:21:26 -05:00
optimizer Fix some more problems with nested append relations. 2014-10-01 19:30:34 -04:00
parser Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
port Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
portability Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
postmaster Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
regex Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
replication Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
rewrite Avoid getting more than AccessShareLock when deparsing a query. 2014-03-06 19:31:12 -05:00
snowball Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
storage Backport "Expose fsync_fname as a public API". 2014-11-15 01:21:30 +01:00
tcop Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
tsearch Predict integer overflow to avoid buffer overruns. 2014-02-17 09:33:33 -05:00
utils Explicitly support the case that a plancache's raw_parse_tree is NULL. 2014-11-12 15:58:47 -05:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
c.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
fmgr.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
funcapi.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
getaddrinfo.h Fix assorted issues in client host name lookup. 2014-04-02 17:11:31 -04:00
getopt_long.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
Makefile Fix server header file installation with vpath builds 2011-11-10 20:52:54 +02:00
miscadmin.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
pg_config.h.in Add mkdtemp() to libpgport. 2014-06-14 09:41:17 -04:00
pg_config.h.win32 Stamp 9.2.9. 2014-07-21 15:12:31 -04:00
pg_config_manual.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
pg_trace.h Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
pgstat.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
pgtime.h Support timezone abbreviations that sometimes change. 2014-10-16 15:22:20 -04:00
port.h Declare mkdtemp() only if we're providing it. 2014-10-17 22:55:30 -04:00
postgres.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
postgres_ext.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
postgres_fe.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
rusagestub.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
windowapi.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00