CODING_STYLE: add section about using strlcat()

parent 0f4a4fef
...@@ -672,3 +672,13 @@ string. ...@@ -672,3 +672,13 @@ string.
Unless you have a valid reason to accept truncation you must check whether 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 truncation has occurred, treat it as an error, and handle the error
appropriately. 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.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment