From: Julian Seward Date: Mon, 17 Nov 2008 12:45:58 +0000 (+0000) Subject: Expand filename for coredumps correctly. Fixes #174908. Also take X-Git-Tag: svn/VALGRIND_3_4_0~120 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=69fcffda222c655fe06efc1f415df7ad3a259c41;p=thirdparty%2Fvalgrind.git Expand filename for coredumps correctly. Fixes #174908. Also take the opportunity to remove some sprintf-ing into a fixed-sized buffer. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8774 --- diff --git a/coregrind/m_coredump/coredump-elf.c b/coregrind/m_coredump/coredump-elf.c index f740b9de99..7fba755e96 100644 --- a/coregrind/m_coredump/coredump-elf.c +++ b/coregrind/m_coredump/coredump-elf.c @@ -286,7 +286,7 @@ static void fill_xfpu(const ThreadState *tst, vki_elf_fpxregset_t *xfpu) 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 @@ void make_elf_coredump(ThreadId tid, const vki_siginfo_t *si, UInt max_size) 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;