* Author: Andreas Pflug <pgadmin@pse-consulting.de>
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/genfile.c,v 1.22 2010/01/02 16:57:54 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/genfile.c,v 1.23 2010/01/05 01:29:36 itagaki Exp $
*
*-------------------------------------------------------------------------
*/
#include "catalog/pg_type.h"
#include "funcapi.h"
+#include "mb/pg_wchar.h"
#include "miscadmin.h"
#include "postmaster/syslogger.h"
#include "storage/fd.h"
(errcode_for_file_access(),
errmsg("could not read file \"%s\": %m", filename)));
+ /* Make sure the input is valid */
+ pg_verifymbstr(VARDATA(buf), nbytes, false);
+
SET_VARSIZE(buf, nbytes + VARHDRSZ);
FreeFile(file);