summaryrefslogtreecommitdiff
path: root/usr.bin/cvs
diff options
context:
space:
mode:
authorJean-Francois Brousseau <jfb@cvs.openbsd.org>2005-04-11 20:32:57 +0000
committerJean-Francois Brousseau <jfb@cvs.openbsd.org>2005-04-11 20:32:57 +0000
commit8364d6eb13cffff931d1eb1fc750f3faf9e2a750 (patch)
tree9c82cc0d887e26bda727837194e0effbeab7e332 /usr.bin/cvs
parentcb8df57f5472d2dfa8976e783dbdedde742376b9 (diff)
modify handling of RCS delta texts so we can handle arbitrary binary
data
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r--usr.bin/cvs/rcs.c11
-rw-r--r--usr.bin/cvs/rcs.h4
2 files changed, 8 insertions, 7 deletions
diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c
index ca613e582c6..ded4e570437 100644
--- a/usr.bin/cvs/rcs.c
+++ b/usr.bin/cvs/rcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.c,v 1.44 2005/04/11 19:36:46 jfb Exp $ */
+/* $OpenBSD: rcs.c,v 1.45 2005/04/11 20:32:56 jfb Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -1057,7 +1057,7 @@ rcs_getrev(RCSFILE *rfp, RCSNUM *rev)
return (NULL);
}
- len = strlen(rdp->rd_text);
+ len = rdp->rd_tlen;
if ((rbuf = cvs_buf_alloc(len, BUF_AUTOEXT)) == NULL)
return (NULL);
@@ -1087,7 +1087,7 @@ rcs_getrev(RCSFILE *rfp, RCSNUM *rev)
return (NULL);
}
bp = cvs_buf_release(rbuf);
- rbuf = rcs_patch((char *)bp, rdp->rd_text);
+ rbuf = rcs_patch((char *)bp, (char *)rdp->rd_text);
if (rbuf == NULL)
break;
} while (rcsnum_cmp(crev, rev, 0) != 0);
@@ -1752,11 +1752,12 @@ rcs_parse_deltatext(RCSFILE *rfp)
return (-1);
}
- rdp->rd_text = cvs_strdup(RCS_TOKSTR(rfp));
+ rdp->rd_text = (u_char *)malloc(RCS_TOKLEN(rfp));
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));
rdp->rd_tlen = RCS_TOKLEN(rfp);
return (1);
@@ -2012,7 +2013,7 @@ rcs_freedelta(struct rcs_delta *rdp)
if (rdp->rd_log != NULL)
cvs_strfree(rdp->rd_log);
if (rdp->rd_text != NULL)
- cvs_strfree(rdp->rd_text);
+ free(rdp->rd_text);
while ((rb = TAILQ_FIRST(&(rdp->rd_branches))) != NULL) {
TAILQ_REMOVE(&(rdp->rd_branches), rb, rb_list);
diff --git a/usr.bin/cvs/rcs.h b/usr.bin/cvs/rcs.h
index 5b38cedd6ab..14ef4c0f3db 100644
--- a/usr.bin/cvs/rcs.h
+++ b/usr.bin/cvs/rcs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.h,v 1.19 2005/04/07 22:08:57 jfb Exp $ */
+/* $OpenBSD: rcs.h,v 1.20 2005/04/11 20:32:56 jfb Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -142,7 +142,7 @@ struct rcs_delta {
char *rd_author;
char *rd_state;
char *rd_log;
- char *rd_text;
+ u_char *rd_text;
size_t rd_tlen;
struct rcs_dlist rd_snodes;