From 3f8ec75fbd7f2be7153ef623ddd194d334955529 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Mon, 29 Oct 2018 11:16:52 +0100 Subject: fonts.c: fix return bug --- fonts.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'fonts.c') diff --git a/fonts.c b/fonts.c index 2ef8052..25f9cf4 100644 --- a/fonts.c +++ b/fonts.c @@ -24,5 +24,8 @@ int render(char *input, int input_len, char *output, int max_output_len, int ski output[output_i*(SYMBOL_WIDTH+1) + i] = symbols[c*SYMBOL_WIDTH + i]; output_i++; } - return output_i*(SYMBOL_WIDTH+1); + if (output_i*(SYMBOL_WIDTH+1) >= max_output_len) + return max_output_len; + else + return output_i*(SYMBOL_WIDTH+1); } -- cgit v1.2.3-70-g09d2