mirror of
git://sourceware.org/git/valgrind.git
synced 2026-01-12 00:19:31 +08:00
Merge r14208 from BUF_REMOVAL branch to trunk.
In function read_dot_valgrindrc use a large enough buffer allocated on the stack. Also assert that the passed in directory is not NULL. This is true at all call sites. The old code would have attempted to read /.valgrindrc for dir == NULL and I don't think we want that. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14580
This commit is contained in:
@@ -59,10 +59,13 @@ static HChar* read_dot_valgrindrc ( const HChar* dir )
|
||||
SysRes fd;
|
||||
struct vg_stat stat_buf;
|
||||
HChar* f_clo = NULL;
|
||||
HChar filename[VKI_PATH_MAX];
|
||||
const HChar dot_valgrindrc[] = ".valgrindrc";
|
||||
|
||||
vg_assert(dir != NULL);
|
||||
|
||||
HChar filename[VG_(strlen)(dir) + 1 + VG_(strlen)(dot_valgrindrc) + 1];
|
||||
VG_(sprintf)(filename, "%s/%s", dir, dot_valgrindrc);
|
||||
|
||||
VG_(snprintf)(filename, VKI_PATH_MAX, "%s/.valgrindrc",
|
||||
( NULL == dir ? "" : dir ) );
|
||||
fd = VG_(open)(filename, 0, VKI_S_IRUSR);
|
||||
if ( !sr_isError(fd) ) {
|
||||
Int res = VG_(fstat)( sr_Res(fd), &stat_buf );
|
||||
|
||||
Reference in New Issue
Block a user