From 69c8e7902ce58e9209e91c9b317c6a466e78e2ea Mon Sep 17 00:00:00 2001
From: Antoine Fontaine <antoine.fontaine@epfl.ch>
Date: Wed, 5 Jun 2019 18:07:02 +0200
Subject: [PATCH] Fixed a valgrind complaint

---
 src/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/utils.c b/src/utils.c
index 9011b62..b8f3036 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -109,7 +109,7 @@ write_file (const char *name, const char *content, size_t size)
   // if we don't make a copy, it will get free'd by the caller
   // before we write content to the file. The content should
   // be "small" (<1MiB): a Moodle web page
-  char *copy = g_strdup (content);
+  char *copy = g_strndup (content, size);
   g_file_replace_contents_async (file,
                                  copy,
                                  size,
-- 
GitLab