1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-13 07:41:39 +03:00

Fix CVE-2013-0255 properly.

Revert commit ab0f7b6089 (in HEAD only)
in favor of the proper solution, which is to declare enum_recv() correctly
in the system catalogs.  It should be declared to take type "internal"
not "cstring".

Also improve the type_sanity regression test, which should have caught
this typo, so that it actually would.  Most of the relevant checks on
the signature of type I/O functions should not have been restricted to
basetypes/pseudotypes, as they should apply to any type's I/O functions.
This commit is contained in:
Tom Lane
2013-02-13 16:20:01 -05:00
parent 9728eda792
commit 71627f3d19
5 changed files with 22 additions and 19 deletions

View File

@ -18,7 +18,6 @@
#include "access/htup_details.h"
#include "catalog/indexing.h"
#include "catalog/pg_enum.h"
#include "catalog/pg_type.h"
#include "libpq/pqformat.h"
#include "utils/array.h"
#include "utils/builtins.h"
@ -105,10 +104,6 @@ enum_recv(PG_FUNCTION_ARGS)
char *name;
int nbytes;
/* guard against pre-9.3 misdeclaration of enum_recv */
if (get_fn_expr_argtype(fcinfo->flinfo, 0) == CSTRINGOID)
elog(ERROR, "invalid argument for enum_recv");
name = pq_getmsgtext(buf, buf->len - buf->cursor, &nbytes);
/* must check length to prevent Assert failure within SearchSysCache */