Skip to content

Commit fede367

Browse files
committed
[Security] Use 'g_strlcpy' instead of 'strcpy'
to avoid warnings with Clang Analyzer
1 parent 4ed829a commit fede367

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

‎libcaja-private/caja-file-operations.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6545,10 +6545,10 @@ mark_desktop_file_trusted (CommonJob *common,
65456545
}
65466546

65476547
if (!g_str_has_prefix (contents, "#!")) {
6548-
new_length = length + strlen (TRUSTED_SHEBANG);
6549-
new_contents = g_malloc (new_length);
6548+
new_length = length + strlen (TRUSTED_SHEBANG) + 1;
6549+
new_contents = g_malloc0 (new_length);
65506550

6551-
strcpy (new_contents, TRUSTED_SHEBANG);
6551+
g_strlcpy (new_contents, TRUSTED_SHEBANG, new_length);
65526552
memcpy (new_contents + strlen (TRUSTED_SHEBANG),
65536553
contents, length);
65546554

‎src/caja-sidebar-title.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ override_title_font (GtkWidget *widget,
433433
g_strreverse (tempsize);
434434

435435
gchar tempfont [strlen (font)];
436-
strcpy (tempfont, font);
436+
g_strlcpy (tempfont, font, sizeof (tempfont));
437437
tempfont [strlen (font) - strlen (tempsize)] = 0;
438438

439439
css = g_strdup_printf ("label { font-family: %s; font-size: %spt; }", tempfont, tempsize);

0 commit comments

Comments
 (0)