Skip to content

Commit e684ab5

Browse files
committed
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
1 parent acfaa59 commit e684ab5

File tree

1 file changed

+1
-1
lines changed
  • src/backend/access/transam

1 file changed

+1
-1
lines changed

src/backend/access/transam/xlog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9481,7 +9481,7 @@ do_pg_stop_backup(char *labelfile, bool waitforarchive)
94819481
* during the backup.
94829482
*/
94839483
ptr = strstr(remaining, "BACKUP FROM:");
9484-
if (sscanf(ptr, "BACKUP FROM: %19s\n", backupfrom) != 1)
9484+
if (!ptr || sscanf(ptr, "BACKUP FROM: %19s\n", backupfrom) != 1)
94859485
ereport(ERROR,
94869486
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
94879487
errmsg("invalid data in file \"%s\"", BACKUP_LABEL_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