diff options
Diffstat (limited to 'apps/gui/line.c')
-rw-r--r-- | apps/gui/line.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/apps/gui/line.c b/apps/gui/line.c index 5a376c652c..d561f08c76 100644 --- a/apps/gui/line.c +++ b/apps/gui/line.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include "settings.h" | 32 | #include "settings.h" |
33 | #include "debug.h" | 33 | #include "debug.h" |
34 | #include "viewport.h" | 34 | #include "viewport.h" |
35 | #include "debug.h" | ||
35 | 36 | ||
36 | #ifdef HAVE_REMOTE_LCD | 37 | #ifdef HAVE_REMOTE_LCD |
37 | #define MAX_LINES (LCD_SCROLLABLE_LINES + LCD_REMOTE_SCROLLABLE_LINES) | 38 | #define MAX_LINES (LCD_SCROLLABLE_LINES + LCD_REMOTE_SCROLLABLE_LINES) |
@@ -158,8 +159,8 @@ static void print_line(struct screen *display, | |||
158 | int xpos = x; | 159 | int xpos = x; |
159 | int icon_y, icon_h, icon_w; | 160 | int icon_y, icon_h, icon_w; |
160 | enum themable_icons icon; | 161 | enum themable_icons icon; |
161 | char tempbuf[128]; | 162 | char tempbuf[MAX_PATH+32]; |
162 | int tempbuf_idx; | 163 | unsigned int tempbuf_idx; |
163 | 164 | ||
164 | height = line->height == -1 ? display->getcharheight() : line->height; | 165 | height = line->height == -1 ? display->getcharheight() : line->height; |
165 | icon_h = get_icon_height(display->screen_type); | 166 | icon_h = get_icon_height(display->screen_type); |
@@ -246,7 +247,15 @@ next: | |||
246 | } | 247 | } |
247 | else | 248 | else |
248 | { /* handle string constant in format string */ | 249 | { /* handle string constant in format string */ |
249 | tempbuf[tempbuf_idx++] = ch; | 250 | if (tempbuf_idx < sizeof(tempbuf)-1) |
251 | { | ||
252 | tempbuf[tempbuf_idx++] = ch; | ||
253 | } | ||
254 | else if (tempbuf_idx == sizeof(tempbuf)-1) | ||
255 | { | ||
256 | tempbuf[tempbuf_idx++] = '\0'; | ||
257 | DEBUGF("%s ", ch ? "put_line: String truncated" : ""); | ||
258 | } | ||
250 | if (!ch) | 259 | if (!ch) |
251 | { /* end of string. put it online */ | 260 | { /* end of string. put it online */ |
252 | put_text(display, xpos, y, line, tempbuf, false, 0); | 261 | put_text(display, xpos, y, line, tempbuf, false, 0); |