Fixes for memory alloc error in charset functions
This commit is contained in:
parent
dfe85b13fc
commit
1941e57b6e
@ -15,6 +15,10 @@ v0.37.01 14-Jan-2003.
|
||||
if you need to downgrade.
|
||||
Spanish templates and macros added to the examples.
|
||||
|
||||
common.a:
|
||||
Remove a bug which very seldom crashed mbfido with charset
|
||||
translation. Do we really need charset conversion?
|
||||
|
||||
mbtask:
|
||||
Arcmail for non-CM nodes and Txx nodes is now sent during the
|
||||
node's opening hours or ZMH.
|
||||
|
2
TODO
2
TODO
@ -43,6 +43,8 @@ mbsebbs:
|
||||
N: If a new mailcheck takes longer then the idle timeout, the user is
|
||||
disconnected as soon as the mailcheck is ready.
|
||||
|
||||
N: In mail areas for only Alias names, the normal usernames show up.
|
||||
|
||||
mbfido:
|
||||
U: Code cleanup and make a structure in this program. Remove duplicate
|
||||
or similar functions.
|
||||
|
@ -139,29 +139,27 @@ char *strnkconv(const char *src, int incode, int outcode, int n)
|
||||
|
||||
char *strkconv(const char *src, int incode, int outcode)
|
||||
{
|
||||
static char *dest;
|
||||
static char *dest;
|
||||
int bytes = 1;
|
||||
|
||||
if ((incode==outcode) && (incode!=CHRS_NOTSET) && (incode!=CHRS_AUTODETECT))
|
||||
return (char *)src;
|
||||
if ((incode==outcode) && (incode!=CHRS_NOTSET) && (incode!=CHRS_AUTODETECT))
|
||||
return (char *)src;
|
||||
|
||||
if (!src)
|
||||
return NULL;
|
||||
if (!src)
|
||||
return NULL;
|
||||
|
||||
if((incode == CHRS_AUTODETECT) || (incode == CHRS_NOTSET)) {
|
||||
if (LANG_BITS == 16) {
|
||||
incode = iso2022_detectcode((char *)src,incode);
|
||||
}
|
||||
if((incode == CHRS_AUTODETECT) || (incode == CHRS_NOTSET)) {
|
||||
if (LANG_BITS == 16) {
|
||||
bytes = 2;
|
||||
incode = iso2022_detectcode((char *)src,incode);
|
||||
}
|
||||
}
|
||||
|
||||
if(dest)
|
||||
free(dest);
|
||||
/* FIXME: should be
|
||||
* dest = (char *)malloc((strlen(src) + 1) + (6 * "number of \n + 1"));
|
||||
*/
|
||||
dest = (char *)malloc(((strlen(src) + 1) * 2) + 6 );
|
||||
|
||||
kconv((char *)src, &dest, incode, outcode);
|
||||
return dest;
|
||||
if(dest)
|
||||
free(dest);
|
||||
dest = (char *)malloc((strlen(src) + 1) + ((6 * bytes) + 1));
|
||||
kconv((char *)src, &dest, incode, outcode);
|
||||
return dest;
|
||||
}
|
||||
|
||||
|
||||
|
@ -386,41 +386,3 @@ void writechrs(int code, FILE *pkt, int ispkt)
|
||||
}
|
||||
|
||||
|
||||
// WORDT NIET GEBRUIKT ??
|
||||
void writecharset(int code, FILE *pip, rfcmsg *msg, rfcmsg *kmsg)
|
||||
{
|
||||
char *p, *charset=NULL;
|
||||
|
||||
charset=getcharset(code);
|
||||
|
||||
if ((p=hdr((char *)"Mime-Version",msg))) fprintf(pip,(char *)"Mime-Version:%s",p);
|
||||
else if ((p=hdr((char *)"RFC-Mime-Version",kmsg))) fprintf(pip,(char *)"Mime-Version: %s",p);
|
||||
else if ((p=hdr((char *)"Mime-Version",kmsg))) fprintf(pip,(char *)"Mime-Version: %s",p);
|
||||
else if ((charset) && (code != CHRS_NOTSET)) fprintf(pip,"Mime-Version: 1.0\n");
|
||||
|
||||
if ((p=hdr((char *)"Content-Type",msg))) fprintf(pip,"Content-Type:%s",p);
|
||||
else if ((p=hdr((char *)"RFC-Content-Type",kmsg))) fprintf(pip,"Content-Type: %s",p);
|
||||
else if ((p=hdr((char *)"Content-Type",kmsg))) fprintf(pip,"Content-Type: %s",p);
|
||||
else if ((charset) && (code != CHRS_NOTSET))
|
||||
{
|
||||
if ((p=hdr((char *)"FSCHTML",kmsg)) || (p=hdr((char *)"HTML",kmsg)))
|
||||
fprintf(pip,"Content-Type: text/html; charset=%s\n",charset);
|
||||
else
|
||||
fprintf(pip,"Content-Type: text/plain; charset=%s\n",charset);
|
||||
}
|
||||
|
||||
if ((p=hdr((char *)"Content-Length",msg))) fprintf(pip,"Content-Length%s",p);
|
||||
else if ((p=hdr((char *)"RFC-Content-Length",kmsg))) fprintf(pip,"Content-Length: %s",p);
|
||||
else if ((p=hdr((char *)"Content-Length",kmsg))) fprintf(pip,"Content-Length: %s",p);
|
||||
|
||||
if ((p=hdr((char *)"Content-Transfer-Encoding",msg))) fprintf(pip,"Content-Transfer-Encoding:%s",p);
|
||||
else if ((p=hdr((char *)"RFC-Content-Transfer-Encoding",kmsg))) fprintf(pip,"Content-Transfer-Encoding: %s",p);
|
||||
else if ((p=hdr((char *)"Content-Transfer-Encoding",kmsg))) fprintf(pip,"Content-Transfer-Encoding: %s",p);
|
||||
else if ((charset) && (code == CHRS_ISO_8859_1_QP)) fprintf(pip,"Content-Transfer-Encoding: quoted-printable\n");
|
||||
else if ((charset) && (code != CHRS_NOTSET)) { fprintf(pip,"Content-Transfer-Encoding: ");
|
||||
if ((code == CHRS_ASCII || code == CHRS_UTF_7)) fprintf(pip,"7bit\n");
|
||||
else if (strncasecmp(charset,"iso-2022-",9) == 0) fprintf(pip,"7bit\n");
|
||||
else fprintf(pip,"8bit\n"); /* all others are 8 bit */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -500,11 +500,13 @@ int rfc2ftn(FILE *fp, faddr *recipient)
|
||||
}
|
||||
}
|
||||
|
||||
hdrsize += 8 + strlen(getchrs(outcode));
|
||||
fprintf(ofp, "\001CHRS: %s\n", getchrs(outcode));
|
||||
if (html_message) {
|
||||
hdrsize += 9;
|
||||
fprintf(ofp, "\1HTML: 5\n");
|
||||
if (getchrs(outcode) != NULL) {
|
||||
hdrsize += 8 + strlen(getchrs(outcode));
|
||||
fprintf(ofp, "\001CHRS: %s\n", getchrs(outcode));
|
||||
if (html_message) {
|
||||
hdrsize += 9;
|
||||
fprintf(ofp, "\1HTML: 5\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (CFG.allowcontrol && (!hdr((char *)"X-FTN-ACUPDATE",msg)) && (p=hdr((char *)"Control",msg))) {
|
||||
@ -531,6 +533,7 @@ int rfc2ftn(FILE *fp, faddr *recipient)
|
||||
fprintf(ofp, "\1TID:");
|
||||
kludgewrite(temp, ofp);
|
||||
}
|
||||
|
||||
if ((splitpart == 0) || (hdrsize < MAXHDRSIZE)) {
|
||||
for (tmp = msg; tmp; tmp = tmp->next) {
|
||||
if ((!strncmp(tmp->key,"X-Fsc-",6)) || (!strncmp(tmp->key,"X-FTN-",6) &&
|
||||
@ -573,6 +576,7 @@ int rfc2ftn(FILE *fp, faddr *recipient)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ZConnect are X-ZC-*: in usenet, \1ZC-*: in FTN */
|
||||
for (tmp=msg;tmp;tmp=tmp->next)
|
||||
if ((!strncmp(tmp->key,"X-ZC-",5))) {
|
||||
@ -625,6 +629,7 @@ int rfc2ftn(FILE *fp, faddr *recipient)
|
||||
charwrite(hdrconv(tmp->val, incode, outcode),ofp);
|
||||
}
|
||||
}
|
||||
|
||||
if (rfcheaders)
|
||||
charwrite((char *)"\n",ofp);
|
||||
if ((hdr((char *)"X-FTN-SOT",msg)) || (sot_kludge))
|
||||
|
Reference in New Issue
Block a user