summaryrefslogtreecommitdiff
path: root/fonts.c
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-10-29 11:16:52 +0100
committerErich Eckner <git@eckner.net>2018-10-31 21:48:36 +0100
commit3f8ec75fbd7f2be7153ef623ddd194d334955529 (patch)
treed9690e454403a6b82083afe417e8939c6f851405 /fonts.c
parent9a4619a9f40843c46ff8acc48e963515d31e3a46 (diff)
downloadanzeige-3f8ec75fbd7f2be7153ef623ddd194d334955529.tar.xz
fonts.c: fix return bug
Diffstat (limited to 'fonts.c')
-rw-r--r--fonts.c5
1 files changed, 4 insertions, 1 deletions
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);
}