projects
/
rocksndiamonds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d1342ae
)
fixed potential buffer overflow
author
Holger Schemel
<holger.schemel@virtion.de>
Sat, 12 Oct 2024 19:13:56 +0000
(21:13 +0200)
committer
Holger Schemel
<holger.schemel@virtion.de>
Sat, 12 Oct 2024 19:13:56 +0000
(21:13 +0200)
src/libgame/text.c
patch
|
blob
|
history
diff --git
a/src/libgame/text.c
b/src/libgame/text.c
index 04893897598075ebd9309927d16d3c8eb6db02ea..2d2d43e02c55cd9f8d498615f2dca66323be8b63 100644
(file)
--- a/
src/libgame/text.c
+++ b/
src/libgame/text.c
@@
-554,8
+554,8
@@
static void setTextBufferCharSize(int *line_length, int *cut_length, int *max_li
int font_height = getFontHeight(font_nr);
int line_height = font_height + line_spacing;
- *line_length =
line_width / font_width
;
- *cut_length =
cut_width / font_width
;
+ *line_length =
MIN(line_width / font_width, MAX_OUTPUT_LINESIZE)
;
+ *cut_length =
MIN(cut_width / font_width, MAX_OUTPUT_LINESIZE)
;
*max_lines = max_height / line_height;
}