Skip to content

Commit c3a1eae

Browse files
committed
Verify input in pg_read_file().
1 parent 54b47c8 commit c3a1eae

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/backend/utils/adt/genfile.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Author: Andreas Pflug <pgadmin@pse-consulting.de>
1010
*
1111
* 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 $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -22,6 +22,7 @@
2222

2323
#include "catalog/pg_type.h"
2424
#include "funcapi.h"
25+
#include "mb/pg_wchar.h"
2526
#include "miscadmin.h"
2627
#include "postmaster/syslogger.h"
2728
#include "storage/fd.h"
@@ -131,6 +132,9 @@ pg_read_file(PG_FUNCTION_ARGS)
131132
(errcode_for_file_access(),
132133
errmsg("could not read file \"%s\": %m", filename)));
133134

135+
/* Make sure the input is valid */
136+
pg_verifymbstr(VARDATA(buf), nbytes, false);
137+
134138
SET_VARSIZE(buf, nbytes + VARHDRSZ);
135139

136140
FreeFile(file);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy