summaryrefslogtreecommitdiffstats
path: root/contrib/cvs/src/logmsg.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2000-10-02 06:33:59 +0000
committerpeter <peter@FreeBSD.org>2000-10-02 06:33:59 +0000
commit590c411955d6975551ffeaf41d7faf4b26f836d1 (patch)
treec2ec0b150478a3cab9fb18e60d02dedbdc1cfd15 /contrib/cvs/src/logmsg.c
parent784ea5066cbea73d04e8ce5783dd0eb842e3ac1f (diff)
downloadFreeBSD-src-590c411955d6975551ffeaf41d7faf4b26f836d1.zip
FreeBSD-src-590c411955d6975551ffeaf41d7faf4b26f836d1.tar.gz
Import cvs-1.11 onto vendor branch.
Diffstat (limited to 'contrib/cvs/src/logmsg.c')
-rw-r--r--contrib/cvs/src/logmsg.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/contrib/cvs/src/logmsg.c b/contrib/cvs/src/logmsg.c
index 6d45ca3..cb08cdf 100644
--- a/contrib/cvs/src/logmsg.c
+++ b/contrib/cvs/src/logmsg.c
@@ -182,7 +182,6 @@ do_editor (dir, messagep, repository, changes)
char *fname;
struct stat pre_stbuf, post_stbuf;
int retcode = 0;
- char *p;
if (noexec || reuse_log_message)
return;
@@ -216,7 +215,6 @@ do_editor (dir, messagep, repository, changes)
{
FILE *tfp;
char buf[1024];
- char *p;
size_t n;
size_t nwrite;
@@ -231,9 +229,9 @@ do_editor (dir, messagep, repository, changes)
{
while (!feof (tfp))
{
+ char *p = buf;
n = fread (buf, 1, sizeof buf, tfp);
nwrite = n;
- p = buf;
while (nwrite > 0)
{
n = fwrite (p, 1, nwrite, fp);
@@ -315,7 +313,8 @@ do_editor (dir, messagep, repository, changes)
if (*messagep)
{
- p = *messagep;
+ size_t message_len = post_stbuf.st_size + 1;
+ size_t offset = 0;
while (1)
{
line_length = getline (&line, &line_chars_allocated, fp);
@@ -327,8 +326,11 @@ do_editor (dir, messagep, repository, changes)
}
if (strncmp (line, CVSEDITPREFIX, CVSEDITPREFIXLEN) == 0)
continue;
- (void) strcpy (p, line);
- p += line_length;
+ if (offset + line_length >= message_len)
+ expand_string (messagep, &message_len,
+ offset + line_length + 1);
+ (void) strcpy (*messagep + offset, line);
+ offset += line_length;
}
}
if (fclose (fp) < 0)
@@ -759,7 +761,7 @@ logfile_write (repository, filter, message, logfp, changes)
}
len = fmt_end - fmt_begin;
- str_list_format = xmalloc (sizeof (char) * (len + 1));
+ str_list_format = xmalloc (len + 1);
strncpy (str_list_format, fmt_begin, len);
str_list_format[len] = '\0';
OpenPOWER on IntegriCloud