libbacktrace: correct memory lengths in Mach-O dsym support

* macho.c (macho_add_dsym): Make space for '/' in dsym.  Use
	correct length when freeing diralc.
This commit is contained in:
Ian Lance Taylor 2020-09-08 14:50:32 -07:00
parent 8183ebcdc1
commit a8a7a97b4e

View File

@ -903,6 +903,7 @@ macho_add_dsym (struct backtrace_state *state, const char *filename,
dsymsuffixdirlen = strlen (dsymsuffixdir);
dsymlen = (dirnamelen
+ 1
+ basenamelen
+ dsymsuffixdirlen
+ basenamelen
@ -925,7 +926,7 @@ macho_add_dsym (struct backtrace_state *state, const char *filename,
if (diralc != NULL)
{
backtrace_free (state, diralc, dirnamelen, error_callback, data);
backtrace_free (state, diralc, dirnamelen + 1, error_callback, data);
diralc = NULL;
}