From 405c6e8a8a64f29b37c154091e1677ef67440e73 Mon Sep 17 00:00:00 2001 From: ShyamsundarR Date: Thu, 26 Jul 2018 13:32:52 -0400 Subject: stack: Reduce stack usage for local variables to store tmpfile names This patch moves stack based PATH_MAX allocations for tmpfile names, to heap allocated names instead. Reducing the impact on stack space used and accruing benefits thereof. Change-Id: I646d9cb091018de6768b3523902788fa2ba14d96 Updates: bz#1193929 Signed-off-by: ShyamsundarR --- libglusterfs/src/graph.y | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'libglusterfs') diff --git a/libglusterfs/src/graph.y b/libglusterfs/src/graph.y index bf7886b5a8e..3c3f7b5bb82 100644 --- a/libglusterfs/src/graph.y +++ b/libglusterfs/src/graph.y @@ -555,14 +555,13 @@ glusterfs_graph_construct (FILE *fp) int tmp_fd = -1; glusterfs_graph_t *graph = NULL; FILE *tmp_file = NULL; - char template[PATH_MAX] = {0}; + char template[] = "/tmp/tmp.XXXXXX"; static pthread_mutex_t graph_mutex = PTHREAD_MUTEX_INITIALIZER; graph = glusterfs_graph_new (); if (!graph) goto err; - strcpy (template, "/tmp/tmp.XXXXXX"); /* coverity[secure_temp] mkstemp uses 0600 as the mode and is safe */ tmp_fd = mkstemp (template); if (-1 == tmp_fd) -- cgit