|
9 | 9 | * Author: Andreas Pflug <pgadmin@pse-consulting.de> |
10 | 10 | * |
11 | 11 | * IDENTIFICATION |
12 | | - * $PostgreSQL: pgsql/src/backend/utils/adt/genfile.c,v 1.22 2010/01/02 16:57:54 momjian Exp $ |
| 12 | + * $PostgreSQL: pgsql/src/backend/utils/adt/genfile.c,v 1.23 2010/01/05 01:29:36 itagaki Exp $ |
13 | 13 | * |
14 | 14 | *------------------------------------------------------------------------- |
15 | 15 | */ |
|
22 | 22 |
|
23 | 23 | #include"catalog/pg_type.h" |
24 | 24 | #include"funcapi.h" |
| 25 | +#include"mb/pg_wchar.h" |
25 | 26 | #include"miscadmin.h" |
26 | 27 | #include"postmaster/syslogger.h" |
27 | 28 | #include"storage/fd.h" |
@@ -131,6 +132,9 @@ pg_read_file(PG_FUNCTION_ARGS) |
131 | 132 | (errcode_for_file_access(), |
132 | 133 | errmsg("could not read file \"%s\": %m",filename))); |
133 | 134 |
|
| 135 | +/* Make sure the input is valid */ |
| 136 | +pg_verifymbstr(VARDATA(buf),nbytes, false); |
| 137 | + |
134 | 138 | SET_VARSIZE(buf,nbytes+VARHDRSZ); |
135 | 139 |
|
136 | 140 | FreeFile(file); |
|