mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-12 10:04:14 +02:00
Fix buffer underrun in configuration test harness.
If the total bytes read from the expect log file was 0 then the last byte of whatever was in memory before harnessLogBuffer would be set to 0. On 32-bit systems this expressed as the high order byte of a pointer being cleared and wackiness (in the form of segfaults) ensued.
This commit is contained in:
parent
0c02481d6e
commit
3014b05dab
@ -105,6 +105,10 @@
|
||||
|
||||
<release-test-list>
|
||||
<release-development-list>
|
||||
<release-item>
|
||||
<p>Fix buffer underrun in configuration test harness.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<p>Make Valgrind return an error even when a non-fatal issue is detected. Update some minor issues discovered in the tests as a result.</p>
|
||||
</release-item>
|
||||
|
@ -142,7 +142,8 @@ harnessLogLoad(const char *logFile)
|
||||
THROW_SYS_ERROR_FMT(FileOpenError, "unable to close log file '%s'", logFile);
|
||||
|
||||
// Remove final linefeed
|
||||
harnessLogBuffer[totalBytes - 1] = 0;
|
||||
if (totalBytes > 0)
|
||||
harnessLogBuffer[totalBytes - 1] = 0;
|
||||
|
||||
FUNCTION_HARNESS_RESULT_VOID();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user