summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2005-04-20 19:18:14 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2005-04-20 19:18:14 +0000
commitf89146cba13d07521aafe77f436a3255fb95e64c (patch)
treee49233ce6f66231ad9b5a0bd20e0917879878e12
parentb72e65ef534da4e0ee5532f538def6d45bf9307b (diff)
Fixes from Derek Price, CAN-2005-0753. ok deraadt@
-rw-r--r--gnu/usr.bin/cvs/src/login.c2
-rw-r--r--gnu/usr.bin/cvs/src/patch.c7
-rw-r--r--gnu/usr.bin/cvs/src/rcs.c8
3 files changed, 10 insertions, 7 deletions
diff --git a/gnu/usr.bin/cvs/src/login.c b/gnu/usr.bin/cvs/src/login.c
index 9c96b8c6d66..8bbfe2406da 100644
--- a/gnu/usr.bin/cvs/src/login.c
+++ b/gnu/usr.bin/cvs/src/login.c
@@ -133,7 +133,7 @@ password_entry_parseline (cvsroot_canonical, warn, linenumber, linebuf)
if (isspace(*(linebuf + 1)))
/* special case since strtoul ignores leading white space */
- entry_version = 0;
+ q = linebuf + 1;
else
entry_version = strtoul (linebuf + 1, &q, 10);
diff --git a/gnu/usr.bin/cvs/src/patch.c b/gnu/usr.bin/cvs/src/patch.c
index 5a208776abc..437c395be17 100644
--- a/gnu/usr.bin/cvs/src/patch.c
+++ b/gnu/usr.bin/cvs/src/patch.c
@@ -375,6 +375,7 @@ patch_fileproc (callerdat, finfo)
struct utimbuf t;
char *vers_tag, *vers_head;
char *rcs = NULL;
+ char *rcs_orig = NULL;
RCSNode *rcsfile;
FILE *fp1, *fp2, *fp3;
int ret = 0;
@@ -404,7 +405,7 @@ patch_fileproc (callerdat, finfo)
if ((rcsfile->flags & VALID) && (rcsfile->flags & INATTIC))
isattic = 1;
- rcs = xmalloc (strlen (finfo->file) + sizeof (RCSEXT) + 5);
+ rcs_orig = rcs = xmalloc (strlen (finfo->file) + sizeof (RCSEXT) + 5);
(void) sprintf (rcs, "%s%s", finfo->file, RCSEXT);
/* if vers_head is NULL, may have been removed from the release */
@@ -743,8 +744,8 @@ failed to read diff file header %s for %s: end of file", tmpfile3, rcs);
free (vers_tag);
if (vers_head != NULL)
free (vers_head);
- if (rcs != NULL)
- free (rcs);
+ if (rcs_orig)
+ free (rcs_orig);
return (ret);
}
diff --git a/gnu/usr.bin/cvs/src/rcs.c b/gnu/usr.bin/cvs/src/rcs.c
index d5da7c21405..4ddcfc69be3 100644
--- a/gnu/usr.bin/cvs/src/rcs.c
+++ b/gnu/usr.bin/cvs/src/rcs.c
@@ -2895,7 +2895,7 @@ RCS_getdate (rcs, date, force_tag_match)
if (retval != NULL)
return (retval);
- if (!force_tag_match || RCS_datecmp (vers->date, date) <= 0)
+ if (vers && (!force_tag_match || RCS_datecmp (vers->date, date) <= 0))
return (xstrdup (vers->version));
else
return (NULL);
@@ -3968,7 +3968,7 @@ RCS_checkout (rcs, workfile, rev, nametag, options, sout, pfn, callerdat)
size_t len;
int free_value = 0;
char *log = NULL;
- size_t loglen;
+ size_t loglen = 0;
Node *vp = NULL;
#ifdef PRESERVE_PERMISSIONS_SUPPORT
uid_t rcs_owner = (uid_t) -1;
@@ -7236,7 +7236,7 @@ RCS_deltas (rcs, fp, rcsbuf, version, op, text, len, log, loglen)
for (ln = 0; ln < headlines.nlines; ++ln)
{
- char buf[80];
+ char *buf;
/* Period which separates year from month in date. */
char *ym;
/* Period which separates month from day in date. */
@@ -7247,10 +7247,12 @@ RCS_deltas (rcs, fp, rcsbuf, version, op, text, len, log, loglen)
if (prvers == NULL)
prvers = vers;
+ buf = xmalloc (strlen (prvers->version) + 24);
sprintf (buf, "%-12s (%-8.8s ",
prvers->version,
prvers->author);
cvs_output (buf, 0);
+ free (buf);
/* Now output the date. */
ym = strchr (prvers->date, '.');