1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-05 00:28:52 +02:00

Check that sha1 checksum is not empty in manifestFileUpdate().

The manifest test module was setting a blank value here and causing a stack overflow because memcpy() is used instead of strcpy().

This was really just a test issue but add an assert just in case the same were to happen in production code.

Also update a bogus checksum in the integration tests to the correct length to avoid running afoul of the assert.

Found with -fsanitize=address.
This commit is contained in:
David Steele
2022-03-24 13:13:35 -06:00
parent 4e5ac11517
commit 14016a86e7
3 changed files with 11 additions and 4 deletions

View File

@ -784,7 +784,8 @@ sub run
$oHostBackup->manifestMunge(
basename($strResumePath),
{&MANIFEST_SECTION_TARGET_FILE =>
{(&MANIFEST_TARGET_PGDATA . '/badchecksum.txt') => {&MANIFEST_SUBKEY_CHECKSUM => BOGUS}}},
{(&MANIFEST_TARGET_PGDATA . '/badchecksum.txt') =>
{&MANIFEST_SUBKEY_CHECKSUM => 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'}}},
false);
}
# Change contents of resumed file without changing size so it will throw a nasty error about the repo having been corrupted