summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/dvipsk/ChangeLog8
-rw-r--r--Build/source/texk/dvipsk/afm2tfm.c8
-rw-r--r--Build/source/texk/dvipsk/dospecial.c2
-rw-r--r--Build/source/texk/dvipsk/drawPS.c5
-rw-r--r--Build/source/texk/dvipsk/emspecial.c11
-rw-r--r--Build/source/texk/dvipsk/finclude.c9
-rw-r--r--Build/source/texk/dvipsk/flib.c2
-rw-r--r--Build/source/texk/dvipsk/hps.c33
8 files changed, 47 insertions, 31 deletions
diff --git a/Build/source/texk/dvipsk/ChangeLog b/Build/source/texk/dvipsk/ChangeLog
index 6c38a08d75b..eea20f93b31 100644
--- a/Build/source/texk/dvipsk/ChangeLog
+++ b/Build/source/texk/dvipsk/ChangeLog
@@ -7,6 +7,14 @@
2010-05-10 Karl Berry <karl@tug.org>
+ * drawPS.c,
+ * flib.c,
+ * finclude.c,
+ * afm2tfm.c,
+ * hps.c,
+ * emspecial.c,
+ * dospecial.c: more snprintf.
+
* all files: remove useless casts to void.
* dosection.c (dosection),
diff --git a/Build/source/texk/dvipsk/afm2tfm.c b/Build/source/texk/dvipsk/afm2tfm.c
index b2dc69ae1bf..7d05bf877f6 100644
--- a/Build/source/texk/dvipsk/afm2tfm.c
+++ b/Build/source/texk/dvipsk/afm2tfm.c
@@ -1247,19 +1247,19 @@ vright(void)
int forceoctal = 0;
-char vcharbuf[6];
+char vcharbuf[100];
static char *
vchar(int c)
{
if (forceoctal == 0 && ISALNUM (c))
- (void) sprintf(vcharbuf,"C %c",
+ sprintf(vcharbuf,"C %c",
#ifndef VMCMS
c);
#else
ascii2ebcdic[c]);
#endif
- else (void) sprintf(vcharbuf,"O %o", (unsigned)c);
- return (vcharbuf);
+ else sprintf(vcharbuf,"O %o", (unsigned)c);
+ return vcharbuf;
}
char vnamebuf[1000];
diff --git a/Build/source/texk/dvipsk/dospecial.c b/Build/source/texk/dvipsk/dospecial.c
index ff8bbf2450b..25af13c567f 100644
--- a/Build/source/texk/dvipsk/dospecial.c
+++ b/Build/source/texk/dvipsk/dospecial.c
@@ -955,7 +955,7 @@ default:
cmdout(cmdbuf);
}
}
- sprintf(cmdbuf, "@%s", KeyStr);
+ snprintf(cmdbuf, sizeof(cmdbuf), "@%s", KeyStr);
cmdout(cmdbuf);
}
diff --git a/Build/source/texk/dvipsk/drawPS.c b/Build/source/texk/dvipsk/drawPS.c
index 5418bc0b76d..2151b2a2721 100644
--- a/Build/source/texk/dvipsk/drawPS.c
+++ b/Build/source/texk/dvipsk/drawPS.c
@@ -594,7 +594,7 @@ SetShade(register char *cp)
void
shadeLast(char *cp)
{
- char tpout[20];
+ char tpout[100];
if (*cp) {
double tempShadetp;
@@ -613,7 +613,8 @@ shadeLast(char *cp)
}
shading = GRAY;
- sprintf(tpout,"%1.3f setgray",shadetp); /* priol@irisa.fr, MJ */
+ snprintf(tpout, sizeof(tpout), "%1.3f setgray", shadetp);
+ /* priol@irisa.fr, MJ */
cmdout(tpout);
} /* end of shadeLast */
diff --git a/Build/source/texk/dvipsk/emspecial.c b/Build/source/texk/dvipsk/emspecial.c
index eba9fdcacd9..c4ef067f2cc 100644
--- a/Build/source/texk/dvipsk/emspecial.c
+++ b/Build/source/texk/dvipsk/emspecial.c
@@ -142,7 +142,7 @@ float emwidth, emheight;
shalfword empoint1, empoint2;
struct empt *empoint;
char emunit[30];
-char emstr[250];
+char emstr[500];
char *emp;
hvpos();
@@ -153,7 +153,7 @@ char *emp;
sscanf(emp, "%f%2s", &emwidth, emunit);
emwidth = emunits(emwidth,emunit);
if (emwidth!=-1.0) {
- sprintf(emstr,"%.1f setlinewidth", emwidth);
+ snprintf(emstr, sizeof(emstr), "%.1f setlinewidth", emwidth);
cmdout(emstr);
#ifdef DEBUG
if (dd(D_SPECIAL))
@@ -252,7 +252,7 @@ char *emp;
#endif
strcpy(emstr,"currentlinewidth");
cmdout(emstr);
- sprintf(emstr,"%.1f setlinewidth", emwidth);
+ snprintf(emstr, sizeof(emstr), "%.1f setlinewidth", emwidth);
cmdout(emstr);
}
empoint = emptget(empoint1);
@@ -1372,7 +1372,7 @@ const char *extarr[]=
static void
emgraph(char *filename, float emwidth, float emheight)
{
- char fname[80];
+ char fname[500];
int filetype;
FILE *f;
char *env;
@@ -1439,7 +1439,8 @@ emgraph(char *filename, float emwidth, float emheight)
bmpgraph(f, fname, emwidth, emheight);
break;
default:
- sprintf(fname,"em:graph: %s: File not found", filename);
+ snprintf(fname, sizeof(fname),
+ "em:graph: %s: File not found", filename);
error(fname);
}
if (f != (FILE *)NULL)
diff --git a/Build/source/texk/dvipsk/finclude.c b/Build/source/texk/dvipsk/finclude.c
index b9a5d2d15bd..eac10dccaa6 100644
--- a/Build/source/texk/dvipsk/finclude.c
+++ b/Build/source/texk/dvipsk/finclude.c
@@ -293,8 +293,9 @@ scan_fontnames(char *str, const char *psfile)
}
} else {
char eb[1000];
- sprintf(eb,"Font %s used in file %s is not in the mapping file.",
- p,psfile);
+ snprintf(eb, sizeof(eb),
+ "Font %s used in file %s is not in the mapping file.",
+ p, psfile);
error(eb);
}
}
@@ -470,11 +471,11 @@ okascmd(char *ss)
static void
nameout(char *area, char *name)
{
- char buf[30];
+ char buf[500];
char *s;
if (*area==0 && okascmd(name)) {
- sprintf(buf, "/%s", name);
+ snprintf(buf, sizeof(buf), "/%s", name);
cmdout(name);
} else {
for (s=area; *s; s++)
diff --git a/Build/source/texk/dvipsk/flib.c b/Build/source/texk/dvipsk/flib.c
index 18ed5475946..4a93bab9dc9 100644
--- a/Build/source/texk/dvipsk/flib.c
+++ b/Build/source/texk/dvipsk/flib.c
@@ -254,7 +254,7 @@ flisearch(char *n, halfword dpi)
flib = 1; /* tell loadfont() not to close it */
/* then seek font within library */
sprintf(name,"%s %s %ddpi",lib->name, n, dpi1);
- if ( fseek(pkfile,entry->offset,0) )
+ if (fseek(pkfile,entry->offset,0) )
badpk("couldn't seek font");
/* make sure it is a PK font */
if (pkbyte()==247) /* pre byte */
diff --git a/Build/source/texk/dvipsk/hps.c b/Build/source/texk/dvipsk/hps.c
index dc20f6a998d..65a1c85d7fd 100644
--- a/Build/source/texk/dvipsk/hps.c
+++ b/Build/source/texk/dvipsk/hps.c
@@ -460,25 +460,28 @@ href_name_match(char *h, char *n)
static void
stamp_hps(Hps_link *pl)
{
- char * tmpbuf;
+ char *tmpbuf;
+ unsigned tmpsize;
+
if (pl == NULL) {
error("stamp_hps: null pl pointer, oh no!");
return;
}
- if(pl->title == NULL) {
+ if (pl->title == NULL) {
error("stamp_hps: null pl->title pointer, oh no!");
return;
}
- tmpbuf = (char *) xmalloc(strlen(pl->title)+200);
+ tmpsize = strlen(pl->title) + 500;
+ tmpbuf = xmalloc(tmpsize);
/* print out the proper pdfm with local page info only
* target info will be in the target dictionary */
- sprintf(tmpbuf,
- " (%s) [[%.0f %.0f %.0f %.0f] [%i %i %i [%i %i]] [%.0f %.0f %.0f]] pdfm ",
- pl->title, pl->rect.llx, pl->rect.lly, pl->rect.urx, pl->rect.ury,
- pl->border[0], pl->border[1], pl->border[2], pl->border[3],pl->border[4],
- pl->color[0], pl->color[1], pl->color[2]);
+ snprintf(tmpbuf, tmpsize,
+ " (%s) [[%.0f %.0f %.0f %.0f] [%i %i %i [%i %i]] [%.0f %.0f %.0f]] pdfm ",
+ pl->title, pl->rect.llx, pl->rect.lly, pl->rect.urx, pl->rect.ury,
+ pl->border[0], pl->border[1], pl->border[2], pl->border[3],pl->border[4],
+ pl->color[0], pl->color[1], pl->color[2]);
cmdout(tmpbuf);
free(tmpbuf);
@@ -492,24 +495,26 @@ static void
stamp_external(char *s, Hps_link *pl)
{
char *tmpbuf;
+ unsigned tmpsize;
if (pl == NULL) {
error("stamp_external: null pl pointer, oh no!");
return;
}
-
if (s == NULL) {
error("stamp_external: null s pointer, oh no!");
return;
}
- tmpbuf = (char *) xmalloc(strlen(s) + 200);
+ tmpsize = strlen(s) + 500;
+ tmpbuf = xmalloc(tmpsize);
/* print out the proper pdfm with local page info only
* target info will be in the target dictionary */
- sprintf(tmpbuf," [[%.0f %.0f %.0f %.0f] [%i %i %i [%i %i]] [%.0f %.0f %.0f]] (%s) pdfm ",
- pl->rect.llx, pl->rect.lly, pl->rect.urx, pl->rect.ury,
- pl->border[0], pl->border[1], pl->border[2], pl->border[3],pl->border[4],
- pl->color[0], pl->color[1], pl->color[2], s);
+ snprintf(tmpbuf, tmpsize,
+ " [[%.0f %.0f %.0f %.0f] [%i %i %i [%i %i]] [%.0f %.0f %.0f]] (%s) pdfm ",
+ pl->rect.llx, pl->rect.lly, pl->rect.urx, pl->rect.ury,
+ pl->border[0], pl->border[1], pl->border[2], pl->border[3],pl->border[4],
+ pl->color[0], pl->color[1], pl->color[2], s);
cmdout(tmpbuf);
free(tmpbuf);
}