Change allocation of array 'temp_src' from heap to stack in mime_header_encode()
This commit is contained in:
parent
abb435a4ad
commit
d50e82f8ec
@ -153,7 +153,7 @@ char* mime_header_encode(char* dest, const char* source, GMsg* msg) {
|
|||||||
const char* s = source;
|
const char* s = source;
|
||||||
char* bp = dest;
|
char* bp = dest;
|
||||||
const char* lp;
|
const char* lp;
|
||||||
char* temp_src = (char*)throw_malloc(4096);
|
char temp_src[4096];
|
||||||
|
|
||||||
if(*msg->charset)
|
if(*msg->charset)
|
||||||
{
|
{
|
||||||
@ -165,11 +165,11 @@ char* mime_header_encode(char* dest, const char* source, GMsg* msg) {
|
|||||||
for(uint len = 0; *s; s++) {
|
for(uint len = 0; *s; s++) {
|
||||||
char* tptr = (char*)ChsTP[(byte)*s];
|
char* tptr = (char*)ChsTP[(byte)*s];
|
||||||
chln = *tptr++;
|
chln = *tptr++;
|
||||||
while(chln-- and (len < 4096)) {
|
while(chln-- and (len < sizeof(temp_src))) {
|
||||||
*(d++) = *tptr++;
|
*(d++) = *tptr++;
|
||||||
++len;
|
++len;
|
||||||
}
|
}
|
||||||
if(len == 4096)
|
if(len == sizeof(temp_src))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*d = NUL;
|
*d = NUL;
|
||||||
@ -221,7 +221,6 @@ char* mime_header_encode(char* dest, const char* source, GMsg* msg) {
|
|||||||
lp = s;
|
lp = s;
|
||||||
|
|
||||||
strcpy(bp, lp);
|
strcpy(bp, lp);
|
||||||
throw_free(temp_src);
|
|
||||||
|
|
||||||
return bp;
|
return bp;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user