summaryrefslogtreecommitdiff
path: root/usr.bin/vi/common/exf.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-06-23 22:40:56 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-06-23 22:40:56 +0000
commit30cb72a00b8cc59895c391cad0f8e31611611ec4 (patch)
tree3e2f67dd80af3489363cf0596b740c6533994e40 /usr.bin/vi/common/exf.c
parent325437057bbda9490b174c8fc6dc8f0e14a8f145 (diff)
Fix snprintf return value usage.
Diffstat (limited to 'usr.bin/vi/common/exf.c')
-rw-r--r--usr.bin/vi/common/exf.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/usr.bin/vi/common/exf.c b/usr.bin/vi/common/exf.c
index 39c781a3f7d..574a16aab3b 100644
--- a/usr.bin/vi/common/exf.c
+++ b/usr.bin/vi/common/exf.c
@@ -482,6 +482,8 @@ file_spath(sp, frp, sbp, existsp)
*p = '\0';
len = snprintf(path,
sizeof(path), "%s/%s", t, name);
+ if (len >= sizeof(path))
+ len = sizeof(path) - 1;
*p = savech;
if (!stat(path, sbp)) {
found = 1;
@@ -941,12 +943,16 @@ file_write(sp, fm, tm, name, flags)
msgstr = msg_cat(sp,
"256|%s: new file: %lu lines, %lu characters", NULL);
len = snprintf(buf, sizeof(buf), msgstr, p, nlno, nch);
+ if (len >= sizeof(buf))
+ len = sizeof(buf) - 1;
break;
case OLDFILE:
msgstr = msg_cat(sp, LF_ISSET(FS_APPEND) ?
"315|%s: appended: %lu lines, %lu characters" :
"257|%s: %lu lines, %lu characters", NULL);
len = snprintf(buf, sizeof(buf), msgstr, p, nlno, nch);
+ if (len >= sizeof(buf))
+ len = sizeof(buf) - 1;
break;
default:
abort();