mirror of
https://github.com/postgres/postgres.git
synced 2025-04-24 10:47:04 +03:00
Verify input in pg_read_file().
This commit is contained in:
parent
54b47c803e
commit
c3a1eae252
@ -9,7 +9,7 @@
|
|||||||
* Author: Andreas Pflug <pgadmin@pse-consulting.de>
|
* Author: Andreas Pflug <pgadmin@pse-consulting.de>
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include "catalog/pg_type.h"
|
#include "catalog/pg_type.h"
|
||||||
#include "funcapi.h"
|
#include "funcapi.h"
|
||||||
|
#include "mb/pg_wchar.h"
|
||||||
#include "miscadmin.h"
|
#include "miscadmin.h"
|
||||||
#include "postmaster/syslogger.h"
|
#include "postmaster/syslogger.h"
|
||||||
#include "storage/fd.h"
|
#include "storage/fd.h"
|
||||||
@ -131,6 +132,9 @@ pg_read_file(PG_FUNCTION_ARGS)
|
|||||||
(errcode_for_file_access(),
|
(errcode_for_file_access(),
|
||||||
errmsg("could not read file \"%s\": %m", filename)));
|
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);
|
SET_VARSIZE(buf, nbytes + VARHDRSZ);
|
||||||
|
|
||||||
FreeFile(file);
|
FreeFile(file);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user