diff options
author | Xavier Santolaria <xsa@cvs.openbsd.org> | 2006-02-26 10:07:51 +0000 |
---|---|---|
committer | Xavier Santolaria <xsa@cvs.openbsd.org> | 2006-02-26 10:07:51 +0000 |
commit | f36c8fa0ecb63d649013680a6a1fcbf083c9382b (patch) | |
tree | 3af5060f2be04b55dc3c69ae5d62623bce4a1a99 /usr.bin/cvs/diff3.c | |
parent | ec4d650170f5013045e6e1e62f3496b0074a7095 (diff) |
out-of-bounds access and correct some printf while here;
Diffstat (limited to 'usr.bin/cvs/diff3.c')
-rw-r--r-- | usr.bin/cvs/diff3.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/usr.bin/cvs/diff3.c b/usr.bin/cvs/diff3.c index 9ba7978fafc..f5b722a3839 100644 --- a/usr.bin/cvs/diff3.c +++ b/usr.bin/cvs/diff3.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff3.c,v 1.13 2006/01/23 16:49:48 xsa Exp $ */ +/* $OpenBSD: diff3.c,v 1.14 2006/02/26 10:07:50 xsa Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. @@ -72,7 +72,7 @@ static const char copyright[] = #ifndef lint static const char rcsid[] = - "$OpenBSD: diff3.c,v 1.13 2006/01/23 16:49:48 xsa Exp $"; + "$OpenBSD: diff3.c,v 1.14 2006/02/26 10:07:50 xsa Exp $"; #endif /* not lint */ #include "includes.h" @@ -234,8 +234,8 @@ cvs_diff3(RCSFILE *rf, char *workfile, RCSNUM *rev1, RCSNUM *rev2) data = cvs_buf_release(b1); diffb = b1 = NULL; - cvs_printf("Merging changes between '%s' and '%s' ", r1, r2); - cvs_printf("into '%s'\n", workfile); + cvs_printf("Merging differences between %s and %s into %s\n", + r1, r2, workfile); if ((diffb = cvs_patchfile(data, patch, ed_patch_lines)) == NULL) goto out; @@ -438,8 +438,10 @@ readin(char *name, struct diff **dd) (*dd)[i].new.to = d; } - (*dd)[i].old.from = (*dd)[i-1].old.to; - (*dd)[i].new.from = (*dd)[i-1].new.to; + if (i) { + (*dd)[i].old.from = (*dd)[i-1].old.to; + (*dd)[i].new.from = (*dd)[i-1].new.to; + } (void)fclose(fp[0]); return (i); |