summaryrefslogtreecommitdiff
path: root/Build/source
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source')
-rw-r--r--Build/source/texk/dvipsk/ChangeLog9
-rw-r--r--Build/source/texk/dvipsk/color.c6
-rw-r--r--Build/source/texk/dvipsk/dospecial.c6
-rw-r--r--Build/source/texk/dvipsk/dvips.h4
-rw-r--r--Build/source/texk/dvipsk/header.c4
5 files changed, 20 insertions, 9 deletions
diff --git a/Build/source/texk/dvipsk/ChangeLog b/Build/source/texk/dvipsk/ChangeLog
index 00322087dc6..e84e57fc577 100644
--- a/Build/source/texk/dvipsk/ChangeLog
+++ b/Build/source/texk/dvipsk/ChangeLog
@@ -1,3 +1,12 @@
+2018-02-20 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * color.c (colorpage),
+ * dospecial.c (bangspecial),
+ * dvips.h (header_list):
+ don't use ersatz array as last struct member; change usage.
+ Reported (implicitly, as part of)
+ https://trac.macports.org/ticket/53974
+
2018-01-27 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
* tfmload.c, dvips.h: Support new JFM spec (3-byte characters
diff --git a/Build/source/texk/dvipsk/color.c b/Build/source/texk/dvipsk/color.c
index d4b0867320c..f78d52630b3 100644
--- a/Build/source/texk/dvipsk/color.c
+++ b/Build/source/texk/dvipsk/color.c
@@ -37,7 +37,7 @@ static struct colorpage {
struct colorpage *next;
integer boploc; /* we use the bop loc as a page indicator */
char *bg;
- char colordat[2];
+ char *colordat;
} *colorhash[COLORHASH];
static char *cstack, *csp, *cend, *bg;
/*
@@ -84,6 +84,7 @@ void initcolor(void) {
for (i=0; i<COLORHASH; i++) {
for (p=colorhash[i]; p; p = q) {
q = p->next;
+ free(p->colordat);
free(p);
}
colorhash[i] = 0;
@@ -216,7 +217,8 @@ bopcolor(int outtops)
}
} else {
p = (struct colorpage *)mymalloc((integer)
- (strlen(cstack) + sizeof(struct colorpage) + MAXCOLORLEN));
+ (sizeof(struct colorpage)));
+ p->colordat = mymalloc(strlen(cstack) + MAXCOLORLEN + 2);
p->next = colorhash[h];
p->boploc = pageloc;
strcpy(p->colordat, cstack);
diff --git a/Build/source/texk/dvipsk/dospecial.c b/Build/source/texk/dvipsk/dospecial.c
index 225dc4e9b23..fed4d811321 100644
--- a/Build/source/texk/dvipsk/dospecial.c
+++ b/Build/source/texk/dvipsk/dospecial.c
@@ -24,7 +24,7 @@ static int specialerrors = 20;
struct bangspecial {
struct bangspecial *next;
- char actualstuff[1]; /* more space will actually be allocated */
+ char *actualstuff;
} *bangspecials = NULL;
void
@@ -556,8 +556,8 @@ case '!':
{
register struct bangspecial *q;
p++;
- q = (struct bangspecial *)mymalloc((integer)
- (sizeof(struct bangspecial) + strlen(p)));
+ q = (struct bangspecial *)mymalloc((integer)(sizeof(struct bangspecial)));
+ q->actualstuff = mymalloc(strlen(p) + 1);
strcpy(q->actualstuff, p);
q->next = bangspecials;
bangspecials = q;
diff --git a/Build/source/texk/dvipsk/dvips.h b/Build/source/texk/dvipsk/dvips.h
index 212be482ebb..b7fb3b427a1 100644
--- a/Build/source/texk/dvipsk/dvips.h
+++ b/Build/source/texk/dvipsk/dvips.h
@@ -1,5 +1,5 @@
/* $Id$
- * Copyright 1986-2016 Tomas Rokicki.
+ * Copyright 1986-2018 Tomas Rokicki.
* This is dvips, a freely redistributable PostScript driver
* for dvi files. You may freely use, modify and/or distribute this
* program or any portion thereof.
@@ -251,7 +251,7 @@ struct header_list {
const char *Hname;
char *precode;
char *postcode;
- char name[1];
+ char *name;
};
/*
* Some machines define putlong in their library.
diff --git a/Build/source/texk/dvipsk/header.c b/Build/source/texk/dvipsk/header.c
index 086616c1ba4..771041db2d4 100644
--- a/Build/source/texk/dvipsk/header.c
+++ b/Build/source/texk/dvipsk/header.c
@@ -39,8 +39,8 @@ add_name_general(const char *s, struct header_list **what, char *pre, char *post
for (p = *what; p != NULL; p = p->next)
if (strcmp(p->name, s)==0)
return 0;
- q = (struct header_list *)mymalloc((integer)(sizeof(struct header_list)
- + strlen(s)));
+ q = (struct header_list *)mymalloc((integer)(sizeof(struct header_list)));
+ q->name = mymalloc(strlen(s) + 1);
q->Hname = infont;
q->next = NULL;
q->precode = pre;