|
From: <sv...@va...> - 2014-08-18 15:43:52
|
Author: florian
Date: Mon Aug 18 15:43:45 2014
New Revision: 14307
Log:
Fix a bug. The buffer for 'dirname' is not provided by the caller.
Modified:
branches/BUF_REMOVAL/coregrind/m_debuginfo/debuginfo.c
Modified: branches/BUF_REMOVAL/coregrind/m_debuginfo/debuginfo.c
==============================================================================
--- branches/BUF_REMOVAL/coregrind/m_debuginfo/debuginfo.c (original)
+++ branches/BUF_REMOVAL/coregrind/m_debuginfo/debuginfo.c Mon Aug 18 15:43:45 2014
@@ -1967,6 +1967,9 @@
UInt fndn_ix;
const HChar *fname, *dname;
+ static HChar *fbuf, *dbuf;
+ static SizeT fbuf_siz, dbuf_siz;
+
vg_assert( (dirname == NULL && dirname_available == NULL)
||
(dirname != NULL && dirname_available != NULL) );
@@ -1975,7 +1978,8 @@
if (si == NULL) {
if (dirname_available) {
*dirname_available = False;
- *dirname[0] = 0;
+ grow_buffer_for_string(&dbuf, &dbuf_siz, "");
+ *dirname = VG_(strcpy)(dbuf, "");
}
// filename used to be an HChar [] and it was not initialised along
// this path. Not good.
@@ -1987,9 +1991,6 @@
return False;
}
- static HChar *fbuf, *dbuf;
- static SizeT fbuf_siz, dbuf_siz;
-
fndn_ix = ML_(fndn_ix)(si, locno);
fname = ML_(fndn_ix2filename) (si, fndn_ix);
|