summaryrefslogtreecommitdiffstats
path: root/tools/coccinelle/replace-strncpy.cocci
diff options
context:
space:
mode:
Diffstat (limited to 'tools/coccinelle/replace-strncpy.cocci')
-rw-r--r--tools/coccinelle/replace-strncpy.cocci8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/coccinelle/replace-strncpy.cocci b/tools/coccinelle/replace-strncpy.cocci
new file mode 100644
index 0000000..18ff131
--- /dev/null
+++ b/tools/coccinelle/replace-strncpy.cocci
@@ -0,0 +1,8 @@
+@@
+type T;
+T[] E;
+expression buf, srclen;
+@@
+
+- strncpy(E, src, srclen)
++ strlcpy(E, src, sizeof(E))