netstar pushed a commit to branch master.

http://git.enlightenment.org/tools/edi.git/commit/?id=3eadca948cf796538f01e6d6241b5caa66d57aed

commit 3eadca948cf796538f01e6d6241b5caa66d57aed
Author: Al Poole <nets...@gmail.com>
Date:   Thu Sep 28 01:39:49 2017 +0100

    edi_file: use a static buffer for the path.
---
 src/bin/edi_file.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/bin/edi_file.c b/src/bin/edi_file.c
index f9e960d..a67e79e 100644
--- a/src/bin/edi_file.c
+++ b/src/bin/edi_file.c
@@ -20,9 +20,10 @@ edi_file_path_hidden(const char *path)
 void
 edi_file_text_replace(const char *path, const char *search, const char 
*replace)
 {
-   char *map, *tempfilepath, *found;
+   char *map, *found;
    FILE *tempfile;
    Eina_File *f;
+   char tempfilepath[PATH_MAX];
    unsigned long long len, idx;
    unsigned int slen;
 
@@ -43,8 +44,7 @@ edi_file_text_replace(const char *path, const char *search, 
const char *replace)
         return;
      }
 
-   tempfilepath = malloc(strlen(path)) + 5;
-   sprintf(tempfilepath, "/tmp/%s.tmp", ecore_file_file_get(path));
+   snprintf(tempfilepath, sizeof(tempfilepath), "/tmp/%s.tmp", 
ecore_file_file_get(path));
 
    tempfile = fopen(tempfilepath, "wb");
    if (!tempfile) goto done;

-- 


Reply via email to