diff options
author | Dave Chapman <dave@dchapman.com> | 2008-03-24 18:40:13 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2008-03-24 18:40:13 +0000 |
commit | 0bb2e05aefc963b0ad1d8ef8b16125c8abec7c1d (patch) | |
tree | d6e95ec093d9fc655f369cee051415e956974efd | |
parent | 10e1acc7adab643746711e8a3c1390f49c4f010f (diff) | |
download | rockbox-0bb2e05aefc963b0ad1d8ef8b16125c8abec7c1d.tar.gz rockbox-0bb2e05aefc963b0ad1d8ef8b16125c8abec7c1d.zip |
Stricter syntax checking of the %V tag - pay attention to the return-code from parse_list, and check for the tailing | symbol.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16784 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/gui/wps_parser.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c index 0a06944ba7..fe601c8855 100644 --- a/apps/gui/wps_parser.c +++ b/apps/gui/wps_parser.c @@ -26,6 +26,7 @@ #include "gwps.h" #ifndef __PCTOOL__ #include "settings.h" +#include "misc.h" #include "debug.h" #include "plugin.h" @@ -562,28 +563,35 @@ static int parse_viewport(const char *wps_bufptr, #ifdef HAVE_LCD_COLOR if (depth == 16) { - parse_list("dddddcc", '|', ptr, &vp->x, &vp->y, &vp->width, - &vp->height, &vp->font, &vp->fg_pattern,&vp->bg_pattern); + if (!(ptr = parse_list("dddddcc", '|', ptr, &vp->x, &vp->y, &vp->width, + &vp->height, &vp->font, &vp->fg_pattern,&vp->bg_pattern))) + return WPS_ERROR_INVALID_PARAM; } else #endif #if (LCD_DEPTH == 2) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 2) if (depth == 2) { - parse_list("dddddgg", '|', ptr, &vp->x, &vp->y, &vp->width, - &vp->height, &vp->font, &vp->fg_pattern, &vp->bg_pattern); + if (!(ptr = parse_list("dddddgg", '|', ptr, &vp->x, &vp->y, &vp->width, + &vp->height, &vp->font, &vp->fg_pattern, &vp->bg_pattern))) + return WPS_ERROR_INVALID_PARAM; } else #endif #if (LCD_DEPTH == 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 1) if (depth == 1) { - parse_list("ddddd", '|', ptr, &vp->x, &vp->y, &vp->width, &vp->height, - &vp->font); + if (!(ptr = parse_list("ddddd", '|', ptr, &vp->x, &vp->y, &vp->width, + &vp->height, &vp->font))) + return WPS_ERROR_INVALID_PARAM; } else #endif {} + /* Check for trailing | */ + if (*ptr != '|') + return WPS_ERROR_INVALID_PARAM; + /* Default to using the user font if the font was an invalid number */ if ((vp->font != FONT_SYSFIXED) && (vp->font != FONT_UI)) vp->font = FONT_UI; |