Skip to content

Commit 137fd47

Browse files
committed
[Security] Use 'g_strlcpy' instead of 'strcpy'
Fixes Clang static analyzer warnings: mate-rr-config.c:549:3: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 strcpy (output->priv->vendor, "???"); ^~~~~~ mate-desktop-item.c:2118:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 strcpy (the_exec, exec); ^~~~~~
1 parent 3233410 commit 137fd47

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

libmate-desktop/mate-desktop-item.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2115,7 +2115,7 @@ mate_desktop_item_launch_on_screen_with_env (
21152115

21162116
/* make a new copy and get rid of spaces */
21172117
the_exec = g_alloca (strlen (exec) + 1);
2118-
strcpy (the_exec, exec);
2118+
g_strlcpy (the_exec, exec, strlen (exec) + 1);
21192119

21202120
if ( ! strip_the_amp (the_exec)) {
21212121
g_set_error (error,

libmate-desktop/mate-rr-config.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ mate_rr_config_load_current (MateRRConfig *config, GError **error)
546546
}
547547
else
548548
{
549-
strcpy (output->priv->vendor, "???");
549+
g_strlcpy (output->priv->vendor, "???", sizeof (output->priv->vendor));
550550
output->priv->product = 0;
551551
output->priv->serial = 0;
552552
}

0 commit comments

Comments
 (0)