summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/FbTk/Font.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/FbTk/Font.cc b/src/FbTk/Font.cc
index b79cdcc..7cacbd5 100644
--- a/src/FbTk/Font.cc
+++ b/src/FbTk/Font.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22//$Id: Font.cc,v 1.11 2004/08/18 16:30:33 rathnor Exp $ 22//$Id: Font.cc,v 1.12 2004/08/25 10:03:09 akir Exp $
23 23
24 24
25#include "StringUtil.hh" 25#include "StringUtil.hh"
@@ -94,10 +94,13 @@ char* recode(iconv_t cd,
94 const char *msg, size_t size) { 94 const char *msg, size_t size) {
95 95
96 // If empty message, yes this can happen, return 96 // If empty message, yes this can happen, return
97 if(strlen(msg) == 0) 97 if(strlen(msg) == 0 || size == 0)
98 return 0; 98 return 0;
99 99
100 size_t inbytesleft = strlen(msg); 100 if(strlen(msg) < size)
101 size = strlen(msg);
102
103 size_t inbytesleft = size;
101 size_t outbytesleft = 4*inbytesleft; 104 size_t outbytesleft = 4*inbytesleft;
102 char *new_msg = new char[outbytesleft]; 105 char *new_msg = new char[outbytesleft];
103 char *new_msg_ptr = new_msg; 106 char *new_msg_ptr = new_msg;