Skip to content

Commit 141b898

Browse files
committed
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
1 parent bc5ac36 commit 141b898

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/backend/access/transam/xlogfuncs.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
#include "utils/guc.h"
3131
#include "utils/timestamp.h"
3232

33+
34+
static void validate_xlog_location(char *str);
35+
36+
3337
/*
3438
* pg_start_backup: set up for taking an on-line backup dump
3539
*
@@ -289,6 +293,8 @@ pg_xlogfile_name_offset(PG_FUNCTION_ARGS)
289293
*/
290294
locationstr = text_to_cstring(location);
291295

296+
validate_xlog_location(locationstr);
297+
292298
if (sscanf(locationstr, "%X/%X", &uxlogid, &uxrecoff) != 2)
293299
ereport(ERROR,
294300
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
@@ -361,6 +367,8 @@ pg_xlogfile_name(PG_FUNCTION_ARGS)
361367

362368
locationstr = text_to_cstring(location);
363369

370+
validate_xlog_location(locationstr);
371+
364372
if (sscanf(locationstr, "%X/%X", &uxlogid, &uxrecoff) != 2)
365373
ereport(ERROR,
366374
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),

0 commit comments

Comments
 (0)