diff options
| author | Christian Hesse | 2018-08-28 18:11:50 +0200 |
|---|---|---|
| committer | Christian Hesse | 2018-09-11 08:47:12 +0200 |
| commit | 7cde5885d8ce53359ee665bb930b1da956e8369a (patch) | |
| tree | 312c9a32abf7888257deb07cf5c1e210a6231803 | |
| parent | b0fc647fe61c19338aec65ffcab513cc84599b18 (diff) | |
| download | cgit-7cde5885d8ce53359ee665bb930b1da956e8369a.tar.gz cgit-7cde5885d8ce53359ee665bb930b1da956e8369a.tar.bz2 cgit-7cde5885d8ce53359ee665bb930b1da956e8369a.zip | |
parsing: ban strncpy()
Git upstream bans strncpy() with commit:
banned.h: mark strncpy() as banned
e488b7aba743d23b830d239dcc33d9ca0745a9ad
Signed-off-by: Christian Hesse <mail@eworm.de>
| -rw-r--r-- | parsing.c | 3 |
1 files changed, 1 insertions, 2 deletions
| @@ -63,8 +63,7 @@ static char *substr(const char *head, const char *tail) | |||
| 63 | if (tail < head) | 63 | if (tail < head) |
| 64 | return xstrdup(""); | 64 | return xstrdup(""); |
| 65 | buf = xmalloc(tail - head + 1); | 65 | buf = xmalloc(tail - head + 1); |
| 66 | strncpy(buf, head, tail - head); | 66 | strlcpy(buf, head, tail - head + 1); |
| 67 | buf[tail - head] = '\0'; | ||
| 68 | return buf; | 67 | return buf; |
| 69 | } | 68 | } |
| 70 | 69 | ||
