From d50e82f8ec75cfadc595c1f19d3d1792d5b2f1dc Mon Sep 17 00:00:00 2001 From: Stas Degteff Date: Sat, 19 Jan 2008 17:40:26 +0000 Subject: [PATCH] Change allocation of array 'temp_src' from heap to stack in mime_header_encode() --- golded3/gectrl.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/golded3/gectrl.cpp b/golded3/gectrl.cpp index 65188d0..ca2a66d 100644 --- a/golded3/gectrl.cpp +++ b/golded3/gectrl.cpp @@ -153,7 +153,7 @@ char* mime_header_encode(char* dest, const char* source, GMsg* msg) { const char* s = source; char* bp = dest; const char* lp; - char* temp_src = (char*)throw_malloc(4096); + char temp_src[4096]; if(*msg->charset) { @@ -165,11 +165,11 @@ char* mime_header_encode(char* dest, const char* source, GMsg* msg) { for(uint len = 0; *s; s++) { char* tptr = (char*)ChsTP[(byte)*s]; chln = *tptr++; - while(chln-- and (len < 4096)) { + while(chln-- and (len < sizeof(temp_src))) { *(d++) = *tptr++; ++len; } - if(len == 4096) + if(len == sizeof(temp_src)) break; } *d = NUL; @@ -221,7 +221,6 @@ char* mime_header_encode(char* dest, const char* source, GMsg* msg) { lp = s; strcpy(bp, lp); - throw_free(temp_src); return bp; }