summaryrefslogtreecommitdiff
path: root/libcaja-private
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2019-02-23 13:35:40 +0100
committerPablo Barciela <[email protected]>2019-03-05 01:18:47 +0100
commitfede3677725c71920288dfa9a6acdd0230e6c68b (patch)
treea050fd99efe80ae0717421de03a831d150646841 /libcaja-private
parent4ed829a1facce691869942de8f41878771189776 (diff)
downloadcaja-fede3677725c71920288dfa9a6acdd0230e6c68b.tar.bz2
caja-fede3677725c71920288dfa9a6acdd0230e6c68b.tar.xz
[Security] Use 'g_strlcpy' instead of 'strcpy'
to avoid warnings with Clang Analyzer
Diffstat (limited to 'libcaja-private')
-rw-r--r--libcaja-private/caja-file-operations.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libcaja-private/caja-file-operations.c b/libcaja-private/caja-file-operations.c
index 51481db0..a12d730c 100644
--- a/libcaja-private/caja-file-operations.c
+++ b/libcaja-private/caja-file-operations.c
@@ -6545,10 +6545,10 @@ mark_desktop_file_trusted (CommonJob *common,
}
if (!g_str_has_prefix (contents, "#!")) {
- new_length = length + strlen (TRUSTED_SHEBANG);
- new_contents = g_malloc (new_length);
+ new_length = length + strlen (TRUSTED_SHEBANG) + 1;
+ new_contents = g_malloc0 (new_length);
- strcpy (new_contents, TRUSTED_SHEBANG);
+ g_strlcpy (new_contents, TRUSTED_SHEBANG, new_length);
memcpy (new_contents + strlen (TRUSTED_SHEBANG),
contents, length);