CVS update [cvs1-11-x-branch]: /ccvs/src/
[email protected] 17 Mar 2005 16:31:51 -0000
| Newsgroups | gmane.comp.version-control.cvs.cvs |
|---|---|
| Message-ID | <[email protected]> |
Tag: cvs1-11-x-branch User: dprice Date: 05/03/17 08:31:51 Modified: /ccvs/src/ ChangeLog, admin.c, commit.c, log.c, mkmodules.c, rcs.c Log: * commit.c (checkaddfile): Avoid dereferencing a NULL pointer in response to a rare error. * admin.c (admin_fileproc), log.c (log_expand_revlist), mkmodules.c (checkout_file), rcs.c (RCS_getdate, RCS_deltas, RCS_findlock_or_tip, RCS_tag2rev): Avoid dereferencing NULL pointer. (Thanks to report from Alen Zukich <[email protected]>.) File Changes: Directory: /ccvs/src/ ===================== File [changed]: ChangeLog Url: https://ccvs.cvshome.org/source/browse/ccvs/src/ChangeLog?r1=1.2336.2.358&r2=1.2336.2.359 Delta lines: +9 -0 ------------------- --- ChangeLog 17 Mar 2005 16:06:07 -0000 1.2336.2.358 +++ ChangeLog 17 Mar 2005 16:31:47 -0000 1.2336.2.359 @@ -1,5 +1,14 @@ 2005-03-17 Derek Price <[email protected]> + * commit.c (checkaddfile): Avoid dereferencing a NULL pointer in + response to a rare error. + * admin.c (admin_fileproc), log.c (log_expand_revlist), mkmodules.c + (checkout_file), rcs.c (RCS_getdate, RCS_deltas, RCS_findlock_or_tip, + RCS_tag2rev): Avoid dereferencing NULL pointer. + (Thanks to report from Alen Zukich <[email protected]>.) + +2005-03-17 Derek Price <[email protected]> + * rcs.c (RCS_reparsercsfile): Avoid memory leak. (Thanks to report from Alen Zukich <[email protected]>.) File [changed]: admin.c Url: https://ccvs.cvshome.org/source/browse/ccvs/src/admin.c?r1=1.80.4.8&r2=1.80.4.9 Delta lines: +7 -0 ------------------- --- admin.c 31 Jan 2005 22:15:10 -0000 1.80.4.8 +++ admin.c 17 Mar 2005 16:31:47 -0000 1.80.4.9 @@ -821,6 +821,13 @@ { tag = xstrdup (arg + 2); rev = RCS_head (rcs); + if (!rev) + { + error (0, 0, "No head revision in archive file `%s'.", + rcs->path); + status = 1; + continue; + } } else { File [changed]: commit.c Url: https://ccvs.cvshome.org/source/browse/ccvs/src/commit.c?r1=1.187.4.29&r2=1.187.4.30 Delta lines: +3 -0 ------------------- --- commit.c 16 Mar 2005 22:00:44 -0000 1.187.4.29 +++ commit.c 17 Mar 2005 16:31:47 -0000 1.187.4.30 @@ -2180,6 +2180,9 @@ fixbranch (rcs, sbranch); head = RCS_getversion (rcs, NULL, NULL, 0, (int *) NULL); + if (!head) + error (1, 0, "No head revision in archive file `%s'.", + rcs->path); magicrev = RCS_magicrev (rcs, head); /* If this is not a new branch, then we will want a dead File [changed]: log.c Url: https://ccvs.cvshome.org/source/browse/ccvs/src/log.c?r1=1.79.4.16&r2=1.79.4.17 Delta lines: +13 -2 -------------------- --- log.c 17 Mar 2005 15:57:42 -0000 1.79.4.16 +++ log.c 17 Mar 2005 16:31:48 -0000 1.79.4.17 @@ -1075,9 +1075,20 @@ /* If both first and last are NULL, it means that we want just the head of the default branch, which is RCS_head. */ nr->first = RCS_head (rcs); + if (!nr->first) + { + if (!really_quiet) + error (0, 0, "No head revision in archive `%s'.", + rcs->path); + nr->last = NULL; + nr->fields = 0; + } + else + { nr->last = xstrdup (nr->first); nr->fields = numdots (nr->first) + 1; } + } else if (r->branchhead) { char *branch; File [changed]: mkmodules.c Url: https://ccvs.cvshome.org/source/browse/ccvs/src/mkmodules.c?r1=1.66.6.5&r2=1.66.6.6 Delta lines: +10 -0 -------------------- --- mkmodules.c 31 Jan 2005 22:15:11 -0000 1.66.6.5 +++ mkmodules.c 17 Mar 2005 16:31:48 -0000 1.66.6.6 @@ -581,7 +581,17 @@ free (rcs); return (1); } + rcsnode = RCS_parsercsfile (rcs); + if (!rcsnode) + { + /* Probably not necessary (?); RCS_parsercsfile already printed a + message. */ + error (0, 0, "Failed to parse `%s'.", rcs); + free (rcs); + return 1; + } + retcode = RCS_checkout (rcsnode, NULL, NULL, NULL, NULL, temp, (RCSCHECKOUTPROC) NULL, (void *) NULL); if (retcode != 0) File [changed]: rcs.c Url: https://ccvs.cvshome.org/source/browse/ccvs/src/rcs.c?r1=1.262.4.34&r2=1.262.4.35 Delta lines: +22 -0 -------------------- --- rcs.c 17 Mar 2005 16:06:07 -0000 1.262.4.34 +++ rcs.c 17 Mar 2005 16:31:48 -0000 1.262.4.35 @@ -2334,6 +2334,12 @@ * the 0 in some other position -- <[email protected]> */ pa = strrchr (rev, '.'); + if (!pa) + /* This might happen, for instance, if an RCS file only contained + * revisions 2.x and higher, and REV == "1". + */ + error (1, 0, "revision `%s' does not exist", tag); + pb = xmalloc (strlen (rev) + 3); *pa++ = 0; (void) sprintf (pb, "%s.%d.%s", rev, RCS_MAGIC_BRANCH, pa); @@ -4773,6 +4779,13 @@ that in other ways if at all anyway (e.g. rcslock.pl). */ p = findnode (rcs->versions, RCS_getbranch (rcs, rcs->branch, 0)); + if (!p) + { + error (0, 0, "RCS file `%s' does not contain its default revision.", + rcs->path); + return NULL; + } + return p->data; } @@ -5619,7 +5632,13 @@ freedeltatext (dtext); if (status != 0) + { + /* If delta has not been added to a List, then freeing the Node key + * won't free delta->version. + */ + if (delta->version) free (delta->version); free_rcsvers_contents (delta); + } return status; } @@ -7463,6 +7482,9 @@ if (vers->branches == NULL) error (1, 0, "missing expected branches in %s", rcs->path); + if (!cpversion) + error (1, 0, "Invalid revision number in `%s'.", + rcs->path); *cpversion = '.'; ++cpversion; cpversion = strchr (cpversion, '.');