Skip to content

Commit 3233410

Browse files
committed
[Security] test-ditem: Use 'g_strlcat' instead of 'strcat'
Fixes Clang static analyzer warning: test-ditem.c:94:2: warning: Call to function 'strcat' 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 'strlcat'. CWE-119 strcat (path, "/foo.desktop"); ^~~~~~
1 parent 82f424e commit 3233410

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libmate-desktop/test-ditem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ test_ditem (const char *file)
9191
"Neu gesetzt!");
9292

9393
getcwd (path, 255 - strlen ("/foo.desktop"));
94-
strcat (path, "/foo.desktop");
94+
g_strlcat (path, "/foo.desktop", sizeof (path));
9595

9696
g_print ("Saving to foo.desktop\n");
9797
uri = g_filename_to_uri (path, NULL, NULL);

0 commit comments

Comments
 (0)