diff options
author | Magnus Hagander <magnus@hagander.net> | 2012-03-04 12:24:09 +0100 |
---|---|---|
committer | Magnus Hagander <magnus@hagander.net> | 2012-03-04 12:25:47 +0100 |
commit | 141b89826ddb82b3afa7cf5e048d28a3d8e1c45c (patch) | |
tree | c0703903b75b044bf4f8ad63e507562c2745fa1b /src/backend/access/transam/xlogfuncs.c | |
parent | bc5ac3686580079bd4ea26bf027178786d77a9ee (diff) | |
download | postgresql-141b89826ddb82b3afa7cf5e048d28a3d8e1c45c.tar.gz postgresql-141b89826ddb82b3afa7cf5e048d28a3d8e1c45c.zip |
More carefully validate xlog location string inputs
Now that we have validate_xlog_location, call it from the previously
existing functions taking xlog locatoins as a string input.
Suggested by Fujii Masao
Diffstat (limited to 'src/backend/access/transam/xlogfuncs.c')
-rw-r--r-- | src/backend/access/transam/xlogfuncs.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/backend/access/transam/xlogfuncs.c b/src/backend/access/transam/xlogfuncs.c index 08b5724b97e..f3c8a09c2aa 100644 --- a/src/backend/access/transam/xlogfuncs.c +++ b/src/backend/access/transam/xlogfuncs.c @@ -30,6 +30,10 @@ #include "utils/guc.h" #include "utils/timestamp.h" + +static void validate_xlog_location(char *str); + + /* * pg_start_backup: set up for taking an on-line backup dump * @@ -289,6 +293,8 @@ pg_xlogfile_name_offset(PG_FUNCTION_ARGS) */ locationstr = text_to_cstring(location); + validate_xlog_location(locationstr); + if (sscanf(locationstr, "%X/%X", &uxlogid, &uxrecoff) != 2) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), @@ -361,6 +367,8 @@ pg_xlogfile_name(PG_FUNCTION_ARGS) locationstr = text_to_cstring(location); + validate_xlog_location(locationstr); + if (sscanf(locationstr, "%X/%X", &uxlogid, &uxrecoff) != 2) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), |