summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2019-02-23 13:35:40 +0100
committerZenWalker <[email protected]>2019-03-04 12:49:48 +0100
commitad07330e1a39bc4469aa9c085a34750f8c505266 (patch)
treea9180471d9ee8c47f1e211ffcae4672df134de54
parente5cacba4f3c7114c62b819108b44bf777902efbc (diff)
downloadcaja-ad07330e1a39bc4469aa9c085a34750f8c505266.tar.bz2
caja-ad07330e1a39bc4469aa9c085a34750f8c505266.tar.xz
[Security] Use 'g_strlcpy' instead of 'strcpy'
to avoid warnings with Clang Analyzer
-rw-r--r--libcaja-private/caja-file-operations.c6
-rw-r--r--src/caja-sidebar-title.c2
2 files changed, 4 insertions, 4 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);
diff --git a/src/caja-sidebar-title.c b/src/caja-sidebar-title.c
index af9cb932..48eb8538 100644
--- a/src/caja-sidebar-title.c
+++ b/src/caja-sidebar-title.c
@@ -433,7 +433,7 @@ override_title_font (GtkWidget *widget,
g_strreverse (tempsize);
gchar tempfont [strlen (font)];
- strcpy (tempfont, font);
+ g_strlcpy (tempfont, font, sizeof (tempfont));
tempfont [strlen (font) - strlen (tempsize)] = 0;
css = g_strdup_printf ("label { font-family: %s; font-size: %spt; }", tempfont, tempsize);