summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-05-14 17:56:18 +0000
committerKarl Berry <karl@freefriends.org>2010-05-14 17:56:18 +0000
commit96e12dec1f1efe0b338a437117600c82bc57d086 (patch)
treea2f511ca90b3e31e55475e13acc3ccaa9cb0a905 /Build
parent9eb0528f4db768f80e29f9f02a4f018ee7269da5 (diff)
more snprintf
git-svn-id: svn://tug.org/texlive/trunk@18242 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/dvipsk/ChangeLog5
-rw-r--r--Build/source/texk/dvipsk/output.c31
-rw-r--r--Build/source/texk/dvipsk/resident.c3
3 files changed, 24 insertions, 15 deletions
diff --git a/Build/source/texk/dvipsk/ChangeLog b/Build/source/texk/dvipsk/ChangeLog
index 1f92c67950a..27c7560d21e 100644
--- a/Build/source/texk/dvipsk/ChangeLog
+++ b/Build/source/texk/dvipsk/ChangeLog
@@ -1,3 +1,8 @@
+2010-05-14 Karl Berry <karl@tug.org>
+
+ * resident.c,
+ * output.c: more sprintf -> snprintf.
+
2010-05-10 Peter Breitenlohner <peb@mppmu.mpg.de>
* dvips.h [SET_BINARY]: Add cast to void.
diff --git a/Build/source/texk/dvipsk/output.c b/Build/source/texk/dvipsk/output.c
index c3aa22a435f..6e64bd7e020 100644
--- a/Build/source/texk/dvipsk/output.c
+++ b/Build/source/texk/dvipsk/output.c
@@ -764,24 +764,27 @@ jscout(int c, char *fs) /* string character out */
numout(-hh);
}
if (strstr(fs,"-UTF32-")!=NULL) {
- sprintf(s, "a<%08x>p", c);
+ snprintf(s, sizeof(s), "a<%08x>p", c);
} else if (strstr(fs,"-UTF8-")!=NULL) {
if (c<0x80) {
- sprintf(s, "a<%02x>p", c);
+ snprintf(s, sizeof(s), "a<%02x>p", c);
} else if (c<0x800) {
- sprintf(s, "a<%02x%02x>p", UCStoUTF8B1(c), UCStoUTF8B2(c));
+ snprintf(s, sizeof(s), "a<%02x%02x>p", UCStoUTF8B1(c), UCStoUTF8B2(c));
} else if (c<0x10000) {
- sprintf(s, "a<%02x%02x%02x>p", UCStoUTF8C1(c), UCStoUTF8C2(c), UCStoUTF8C3(c));
+ snprintf(s, sizeof(s), "a<%02x%02x%02x>p", UCStoUTF8C1(c),
+ UCStoUTF8C2(c), UCStoUTF8C3(c));
} else if (c<0x110000) {
- sprintf(s, "a<%02x%02x%02x%02x>p", UCStoUTF8D1(c), UCStoUTF8D2(c), UCStoUTF8D3(c), UCStoUTF8D4(c));
+ snprintf(s, sizeof(s), "a<%02x%02x%02x%02x>p", UCStoUTF8D1(c),
+ UCStoUTF8D2(c), UCStoUTF8D3(c), UCStoUTF8D4(c));
} else {
error("warning: Illegal code value.");
}
} else if (c>0xffff && strstr(fs,"-UTF16-")!=NULL) {
- sprintf(s, "a<%04x%04x>p", UTF32toUTF16HS(c), UTF32toUTF16LS(c));
+ snprintf(s, sizeof(s), "a<%04x%04x>p",
+ UTF32toUTF16HS(c), UTF32toUTF16LS(c));
} else {
if ((strstr(fs,"-RKSJ-")!=NULL)) c = JIStoSJIS(c);
- sprintf(s, "a<%04x>p", c);
+ snprintf(s, sizeof(s), "a<%04x>p", c);
}
cmdout(s);
instring = 0;
@@ -833,30 +836,30 @@ chrcmd(char c)
void
floatout(float n)
{
- char buf[20];
+ char buf[50];
- sprintf(buf, "%.2f", n);
+ snprintf(buf, sizeof(buf), "%.2f", n);
cmdout(buf);
}
void
doubleout(double n)
{
- char buf[40];
+ char buf[50];
- sprintf(buf, "%g", n);
+ snprintf(buf, sizeof(buf), "%g", n);
cmdout(buf);
}
void
numout(integer n)
{
- char buf[10];
+ char buf[50];
#ifdef SHORTINT
- sprintf(buf, "%ld", n);
+ snprintf(buf, sizeof(buf), "%ld", n);
#else
- sprintf(buf, "%d", n);
+ snprintf(buf, sizeof(buf), "%d", n);
#endif
cmdout(buf);
}
diff --git a/Build/source/texk/dvipsk/resident.c b/Build/source/texk/dvipsk/resident.c
index 453911f5f95..a82a801ed4e 100644
--- a/Build/source/texk/dvipsk/resident.c
+++ b/Build/source/texk/dvipsk/resident.c
@@ -774,7 +774,8 @@ default:
if (printer)
{
char msg[1000];
- sprintf (msg, "warning: no config file for `%s'", printer);
+ snprintf (msg, sizeof(msg), "warning: no config file for `%s'",
+ printer);
error(msg);
return 0;
}