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

Use strNewZ() in cases where STRDEF() assignment goes out of scope.

If a variable assigned with STRDEF() is referenced out of scope of the STRDEF() assignment then the value is undefined.

Luckily most of the instances are in tests but there is one in the core code. It is not clear if this is a live bug or not but it certainly needs to be fixed.

Found with -fsanitize=address.
This commit is contained in:
David Steele
2022-03-24 12:26:09 -06:00
parent edf6c70baa
commit 75b26319ae
5 changed files with 7 additions and 7 deletions

View File

@ -1748,7 +1748,7 @@ testRun(void)
manifestResume = manifestNewInternal();
manifestResume->pub.info = infoNew(NULL);
manifestResume->pub.data.backupType = backupTypeFull;
manifestResume->pub.data.backupLabel = STRDEF("20191003-105320F");
manifestResume->pub.data.backupLabel = strNewZ("20191003-105320F");
manifestResume->pub.data.pgVersion = PG_VERSION_12;
}
OBJ_NEW_END();