1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-17 03:25:46 +00:00
freebsd-ports/mail/emil/files/patch-mime.c
Johan van Selst 40a3b0ef5f - Respect $CC
- Fix build with clang
- Regenerate patchfiles after including the clang patches
2011-07-25 18:54:26 +00:00

47 lines
1.5 KiB
C

--- mime.c.orig 1996-06-04 15:36:59.000000000 +0200
+++ mime.c 2011-07-25 20:21:13.000000000 +0200
@@ -56,18 +56,18 @@ encode_mime(struct message *m)
if (match(m->sd->type, "TEXT"))
{
if (m->td->charset != NULL)
- sprintf(buf, "%s; charset=\"%s\"", ct, m->td->charset);
+ snprintf(buf, sizeof(buf), "%s; charset=\"%s\"", ct, m->td->charset);
else
- sprintf(buf, "%s", ct);
+ snprintf(buf, sizeof(buf), "%s", ct);
}
else
if (match(m->sd->type, "MULTIPART"))
{
bb = (char *)getmimebound();
if (m->sd->applefile == AMDOUBLE)
- sprintf(buf, "Multipart/AppleDouble; boundary=\"%s\"", bb);
+ snprintf(buf, sizeof(buf), "Multipart/AppleDouble; boundary=\"%s\"", bb);
else
- sprintf(buf,"%s; boundary=\"%s\"", ct, bb);
+ snprintf(buf, sizeof(buf), "%s; boundary=\"%s\"", ct, bb);
m->td->startbound = (char *)Yalloc(MIMEBOUNDLEN + 5);
m->td->endbound = (char *)Yalloc(MIMEBOUNDLEN + 7);
sprintf(m->td->startbound, "--%s", bb);
@@ -75,7 +75,7 @@ encode_mime(struct message *m)
}
else
{
- sprintf(buf, "%s", ct);
+ snprintf(buf, sizeof(buf), "%s", ct);
}
}
else
@@ -87,7 +87,10 @@ encode_mime(struct message *m)
if (m->sd->name != NULL)
{
- sprintf(buf, "%s; name=\"%s\"", buf, m->sd->name);
+ char *buf2;
+ buf2 = strdup(buf);
+ snprintf(buf, sizeof(buf), "%s; name=\"%s\"", buf2, m->sd->name);
+ free(buf2);
}
add_header(m, "Content-Type", buf, MIME);
if (bb != NULL)