mirror of
https://git.zx2c4.com/cgit
synced 2024-11-22 16:38:42 +00:00
parsing: ban strncpy()
Git upstream bans strncpy() with commit: banned.h: mark strncpy() as banned e488b7aba743d23b830d239dcc33d9ca0745a9ad Signed-off-by: Christian Hesse <mail@eworm.de>
This commit is contained in:
parent
b0fc647fe6
commit
7cde5885d8
@ -63,8 +63,7 @@ static char *substr(const char *head, const char *tail)
|
|||||||
if (tail < head)
|
if (tail < head)
|
||||||
return xstrdup("");
|
return xstrdup("");
|
||||||
buf = xmalloc(tail - head + 1);
|
buf = xmalloc(tail - head + 1);
|
||||||
strncpy(buf, head, tail - head);
|
strlcpy(buf, head, tail - head + 1);
|
||||||
buf[tail - head] = '\0';
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user