Skip to content

Commit

Permalink
CODING_STYLE: add section about using strlcat()
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Dec 10, 2018
1 parent 1828469 commit c13a1a0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions CODING_STYLE.md
Expand Up @@ -672,3 +672,13 @@ string.
Unless you have a valid reason to accept truncation you must check whether
truncation has occurred, treat it as an error, and handle the error
appropriately.
#### Use `strlcat()` instead of `strncat()`
When concatenating strings always use `strlcat()` instead of `strncat()`. The
advantage of `strlcat()` is that it will always append a `\0` byte to the
string.
Unless you have a valid reason to accept truncation you must check whether
truncation has occurred, treat it as an error, and handle the error
appropriately.

0 comments on commit c13a1a0

Please sign in to comment.