|
From: <sv...@va...> - 2008-11-17 12:46:09
|
Author: sewardj
Date: 2008-11-17 12:45:58 +0000 (Mon, 17 Nov 2008)
New Revision: 8774
Log:
Expand filename for coredumps correctly. Fixes #174908. Also take
the opportunity to remove some sprintf-ing into a fixed-sized buffer.
Modified:
trunk/coregrind/m_coredump/coredump-elf.c
Modified: trunk/coregrind/m_coredump/coredump-elf.c
===================================================================
--- trunk/coregrind/m_coredump/coredump-elf.c 2008-11-17 12:45:01 UTC (rev 8773)
+++ trunk/coregrind/m_coredump/coredump-elf.c 2008-11-17 12:45:58 UTC (rev 8774)
@@ -286,7 +286,7 @@
static
void make_elf_coredump(ThreadId tid, const vki_siginfo_t *si, UInt max_size)
{
- Char buf[1000];
+ Char* buf = NULL;
Char *basename = "vgcore";
Char *coreext = "";
Int seq = 0;
@@ -306,9 +306,18 @@
if (VG_(clo_log_name) != NULL) {
coreext = ".core";
- basename = VG_(clo_log_name);
+ basename = VG_(expand_file_name)(
+ "--log-file (while creating core filename)",
+ VG_(clo_log_name));
}
+ vg_assert(coreext);
+ vg_assert(basename);
+ buf = VG_(malloc)( "coredump-elf.mec.1",
+ VG_(strlen)(coreext) + VG_(strlen)(basename)
+ + 100/*for the two %ds. */ );
+ vg_assert(buf);
+
for(;;) {
SysRes sres;
|