sbase

suckless unix tools
git clone git://git.suckless.org/sbase
Log | Files | Refs | README | LICENSE

commit b95c8ed79e5d5322dd3c5c386c3acd62105ac116
parent 78bfd8978ea2af10dadc3fdadd19710068a632c4
Author: Roberto E. Vargas Caballero <roberto.vargas@igrid-td.com>
Date:   Tue, 10 Jan 2017 08:46:48 +0100

ed: Don't use strlcpy()

All the buffers related to files have FILENAME_MAX size, so it is impossible
to have any buffer overrun.

Diffstat:
Med.c | 5++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/ed.c b/ed.c @@ -611,7 +611,7 @@ dowrite(const char *fname, int trunc) curln = line2; if (fclose(fp)) error("input/output error"); - if (strlcpy(savfname, fname, sizeof(savfname)) >= sizeof(savfname)) + if (strcpy(savfname, fname, sizeof(savfname)) >= sizeof(savfname)) error("file name too long"); modflag = 0; curln = line; @@ -743,8 +743,7 @@ getfname(char comm) } else { *bp = '\0'; if (savfname[0] == '\0' || comm == 'e' || comm == 'f') - if (strlcpy(savfname, fname, sizeof(savfname)) >= sizeof(savfname)) - error("file name too long"); + strcpy(savfname, fname); return fname; }