Avoid possible strlen() on NULL content
authorLeonardo Taccari <iamleot@gmail.com>
Sun, 21 Oct 2018 16:21:51 +0000 (18:21 +0200)
committerLeonardo Taccari <iamleot@gmail.com>
Wed, 24 Oct 2018 22:24:06 +0000 (00:24 +0200)
src/util.c

index d18bc72..0255e54 100644 (file)
@@ -133,6 +133,11 @@ gboolean util_create_tmp_file(const char *content, char **file)
         return FALSE;
     }
 
+    if (content == NULL) {
+       close(fp);
+       return TRUE;
+    }
+
     len = strlen(content);
 
     /* write content into temporary file */