Avoid copying background to itself

`init_new_page` calls `load_briefing_screen` with the a pointer to
`br->background_name`, which causes a strncpy of the form

```
	strncpy(X, X, N);
```

Valgrind warns for this overlap.  The copy is useless in that case, so
skip it.
This commit is contained in:
Kp 2019-07-07 22:00:02 +00:00
parent 597cb41717
commit d750b25073

View file

@ -1359,8 +1359,12 @@ static int load_briefing_screen(grs_canvas &canvas, briefing *const br, const ch
init_char_pos(br, br->screen->text_ulx, br->screen->text_uly);
#elif defined(DXX_BUILD_DESCENT_II)
free_briefing_screen(br);
br->background_name.back() = 0;
strncpy(br->background_name.data(), fname, br->background_name.size() - 1);
const auto bndata = br->background_name.data();
if (fname != bndata)
{
br->background_name.back() = 0;
strncpy(bndata, fname, br->background_name.size() - 1);
}
pcx_result pcx_error;
if ((pcx_error = pcx_read_bitmap(fname, br->background, gr_palette)) != pcx_result::SUCCESS)