Use strlcpy() instead of explicitly set \0 on the tail of the array.
This commit is contained in:
parent
431586a895
commit
884f7c03dd
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=194796
@ -142,8 +142,7 @@ add(const char *fmt)
|
||||
badfmt(fmt);
|
||||
if (!(tfu->fmt = malloc(p - savep + 1)))
|
||||
err(1, NULL);
|
||||
(void) strncpy(tfu->fmt, savep, p - savep);
|
||||
tfu->fmt[p - savep] = '\0';
|
||||
(void) strlcpy(tfu->fmt, savep, p - savep + 1);
|
||||
escape(tfu->fmt);
|
||||
p++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user