+2019-01-24 Martin Liska <mliska@suse.cz>
+
+ PR gcov-profile/88994
+ * gcov-io.c (mangle_path): Do not allocate a bigger buffer,
+ result will be always smaller or equal to the original.
+ * gcov.c (mangle_name): Fix else branch where we should
+ also copy to PTR and shift the pointer.
+
2019-01-24 Xiong Hu Luo <luoxhu@linux.vnet.ibm.com>
* tree-ssa-dom.c (test_for_singularity): fix a comment typo.
/* Convert '/' to '#', convert '..' to '^',
convert ':' to '~' on DOS based file system. */
const char *probe;
- char *buffer = (char *)xmalloc (strlen (base) + 10);
+ char *buffer = (char *)xmalloc (strlen (base) + 1);
char *ptr = buffer;
#if HAVE_DOS_BASED_FILE_SYSTEM
return result;
}
+/* Mangle BASE name, copy it at the beginning of PTR buffer and
+ return address of the \0 character of the buffer. */
+
static char *
mangle_name (char const *base, char *ptr)
{
/* Generate the source filename part. */
if (!flag_preserve_paths)
- {
- base = lbasename (base);
- len = strlen (base);
- memcpy (ptr, base, len);
- ptr += len;
- }
+ base = lbasename (base);
else
- ptr = mangle_path (base);
+ base = mangle_path (base);
+
+ len = strlen (base);
+ memcpy (ptr, base, len);
+ ptr += len;
return ptr;
}