From abb838664702ebd4123948f8e002fd5f58714157 Mon Sep 17 00:00:00 2001 From: jdgordon Date: Fri, 19 Feb 2010 23:49:17 +0000 Subject: [PATCH] fix possible out-of-bounds error on remote lcd targets if they try loading a font to id==2 git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24779 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/skin_engine/skin_parser.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index fe68c7c57..0a7dfd407 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c @@ -692,6 +692,9 @@ static int parse_image_load(const char *wps_bufptr, return skip_end_of_line(wps_bufptr); } +/* this array acts as a simple mapping between the id the user uses for a font + * and the id the font actually gets from the font loader. + * font id 2 is always the first skin font (regardless of how many screens */ static int font_ids[MAXUSERFONTS]; static int parse_font_load(const char *wps_bufptr, struct wps_token *token, struct wps_data *wps_data) @@ -715,7 +718,7 @@ static int parse_font_load(const char *wps_bufptr, if (id <= FONT_UI || id >= MAXFONTS-1) return WPS_ERROR_INVALID_PARAM; - id -= SYSTEMFONTCOUNT; + id -= FONT_UI; memcpy(buf, filename, ptr-filename); buf[ptr-filename] = '\0'; -- 2.11.4.GIT