Use strlcpy() instead of explicitly set \0 on the tail of the array.
This commit is contained in:
parent
431586a895
commit
884f7c03dd
@ -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…
x
Reference in New Issue
Block a user