Skip to content

Commit

Permalink
devtools/cocci: make strlcpy replacement smarter
Browse files Browse the repository at this point in the history
The original coccinelle script worked by replacing instances of
snprintf(.."%s",...) with strlcpy(), but only where the source and dest
parameters were plain identifiers. Allowing expressions for those params
opens up a wide range of other possible changes.

Signed-off-by: Bruce Richardson <[email protected]>
  • Loading branch information
bruce-richardson authored and tmonjalo committed Apr 4, 2019
1 parent f4206d1 commit a5df16c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions devtools/cocci/strlcpy.cocci
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@use_strlcpy@
identifier src, dst;
expression size;
expression src, dst, size;
@@
(
- snprintf(dst, size, "%s", src)
Expand Down

0 comments on commit a5df16c

Please sign in to comment.