summaryrefslogtreecommitdiff
path: root/usr.bin/cvs
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2005-10-02 21:44:19 +0000
committerJoris Vink <joris@cvs.openbsd.org>2005-10-02 21:44:19 +0000
commit34e6e7d06d3f634c61e7194d90981663acc2e1b1 (patch)
tree36d7ef57287665ebed9ba157efa623cd8be512b7 /usr.bin/cvs
parenta05bc6e2aec5ea656d581c7ab2c6715f7313e4b7 (diff)
correctly copy and NUL-terminate deltatext strings so we don't end up
using garbage in rcs_patch_lines().
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r--usr.bin/cvs/rcs.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c
index c78d0eb897e..0e070d6d48e 100644
--- a/usr.bin/cvs/rcs.c
+++ b/usr.bin/cvs/rcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.c,v 1.73 2005/09/30 15:06:46 joris Exp $ */
+/* $OpenBSD: rcs.c,v 1.74 2005/10/02 21:44:18 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -2209,12 +2209,12 @@ rcs_parse_deltatext(RCSFILE *rfp)
return (-1);
}
- rdp->rd_text = (u_char *)malloc(RCS_TOKLEN(rfp));
+ rdp->rd_text = (u_char *)malloc(RCS_TOKLEN(rfp) + 1);
if (rdp->rd_text == NULL) {
cvs_log(LP_ERRNO, "failed to copy RCS delta text");
return (-1);
}
- memcpy(rdp->rd_text, RCS_TOKSTR(rfp), RCS_TOKLEN(rfp));
+ strlcpy(rdp->rd_text, RCS_TOKSTR(rfp), (RCS_TOKLEN(rfp) + 1));
rdp->rd_tlen = RCS_TOKLEN(rfp);
return (1);