summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2006-12-19 15:15:15 +0000
committerJoris Vink <joris@cvs.openbsd.org>2006-12-19 15:15:15 +0000
commit9437d03d7d6ce7b2dcb99c7762474eac94deefe4 (patch)
tree4b708fc2a0d2624024fcba49b11a7a8c9255c5cb /usr.bin
parentb48f7c652516d74d3c0efbb33a5a4bb55cae6bef (diff)
correctly check snprintf(), noticed by ray@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cvs/add.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/cvs/add.c b/usr.bin/cvs/add.c
index 13025a8fe41..0f56c6b84b0 100644
--- a/usr.bin/cvs/add.c
+++ b/usr.bin/cvs/add.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: add.c,v 1.63 2006/12/19 15:12:59 joris Exp $ */
+/* $OpenBSD: add.c,v 1.64 2006/12/19 15:15:14 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -111,6 +111,9 @@ cvs_add_entry(struct cvs_file *cf)
entry = xmalloc(CVS_ENT_MAXLINELEN);
l = snprintf(entry, CVS_ENT_MAXLINELEN,
"D/%s/////", cf->file_name);
+ if (l == -1 || l >= CVS_ENT_MAXLINELEN)
+ fatal("cvs_add_entry: overflow");
+
entlist = cvs_ent_open(cf->file_wd);
cvs_ent_add(entlist, entry);
cvs_ent_close(entlist, ENT_SYNC);