Add additional safety check against invalid backup label file
It was already checking for invalid data after "BACKUP FROM", but would possibly crash if "BACKUP FROM" was missing altogether. found by Coverity
This commit is contained in:
parent
acfaa596cc
commit
e684ab5e1e
@ -9481,7 +9481,7 @@ do_pg_stop_backup(char *labelfile, bool waitforarchive)
|
||||
* during the backup.
|
||||
*/
|
||||
ptr = strstr(remaining, "BACKUP FROM:");
|
||||
if (sscanf(ptr, "BACKUP FROM: %19s\n", backupfrom) != 1)
|
||||
if (!ptr || sscanf(ptr, "BACKUP FROM: %19s\n", backupfrom) != 1)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
||||
errmsg("invalid data in file \"%s\"", BACKUP_LABEL_FILE)));
|
||||
|
Loading…
Reference in New Issue
Block a user