diff options
author | peter <peter@FreeBSD.org> | 2004-06-10 19:05:38 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2004-06-10 19:05:38 +0000 |
commit | 8416bda1d23bda4666a5b880a9d78eccaa640036 (patch) | |
tree | 7d97944b58f1e30ab542f9c3d6720b69314cec4d /contrib/cvs/src/history.c | |
parent | 3d101ef985844544d089e129157a94a0640fd246 (diff) | |
download | FreeBSD-src-8416bda1d23bda4666a5b880a9d78eccaa640036.zip FreeBSD-src-8416bda1d23bda4666a5b880a9d78eccaa640036.tar.gz |
Import cvs-1.11.17 onto vendor branch.
Diffstat (limited to 'contrib/cvs/src/history.c')
-rw-r--r-- | contrib/cvs/src/history.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/contrib/cvs/src/history.c b/contrib/cvs/src/history.c index 8e8d607..154c2de 100644 --- a/contrib/cvs/src/history.c +++ b/contrib/cvs/src/history.c @@ -416,8 +416,11 @@ history (argc, argv) working = 1; break; case 'X': /* Undocumented debugging flag */ +#ifdef DEBUG histfile = optarg; +#endif break; + case 'D': /* Since specified date */ if (*since_rev || *since_tag || *backto) { @@ -906,9 +909,13 @@ save_user (name) { if (user_count == user_max) { - user_max += USER_INCREMENT; - user_list = (char **) xrealloc ((char *) user_list, - (int) user_max * sizeof (char *)); + user_max = xsum (user_max, USER_INCREMENT); + if (size_overflow_p (xtimes (user_max, sizeof (char *)))) + { + error (0, 0, "save_user: too many users"); + return; + } + user_list = xrealloc (user_list, xtimes (user_max, sizeof (char *))); } user_list[user_count++] = xstrdup (name); } @@ -936,9 +943,13 @@ save_file (dir, name, module) if (file_count == file_max) { - file_max += FILE_INCREMENT; - file_list = (struct file_list_str *) xrealloc ((char *) file_list, - file_max * sizeof (*fl)); + file_max = xsum (file_max, FILE_INCREMENT); + if (size_overflow_p (xtimes (file_max, sizeof (*fl)))) + { + error (0, 0, "save_file: too many files"); + return; + } + file_list = xrealloc (file_list, xtimes (file_max, sizeof (*fl))); } fl = &file_list[file_count++]; fl->l_file = cp = xmalloc (strlen (dir) + strlen (name) + 2); @@ -977,9 +988,13 @@ save_module (module) { if (mod_count == mod_max) { - mod_max += MODULE_INCREMENT; - mod_list = (char **) xrealloc ((char *) mod_list, - mod_max * sizeof (char *)); + mod_max = xsum (mod_max, MODULE_INCREMENT); + if (size_overflow_p (xtimes (mod_max, sizeof (char *)))) + { + error (0, 0, "save_module: too many modules"); + return; + } + mod_list = xrealloc (mod_list, xtimes (mod_max, sizeof (char *))); } mod_list[mod_count++] = xstrdup (module); } |