diff options
-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 @@ | |||
26 | #include "gwps.h" | 26 | #include "gwps.h" |
27 | #ifndef __PCTOOL__ | 27 | #ifndef __PCTOOL__ |
28 | #include "settings.h" | 28 | #include "settings.h" |
29 | #include "misc.h" | ||
29 | #include "debug.h" | 30 | #include "debug.h" |
30 | #include "plugin.h" | 31 | #include "plugin.h" |
31 | 32 | ||
@@ -562,28 +563,35 @@ static int parse_viewport(const char *wps_bufptr, | |||
562 | #ifdef HAVE_LCD_COLOR | 563 | #ifdef HAVE_LCD_COLOR |
563 | if (depth == 16) | 564 | if (depth == 16) |
564 | { | 565 | { |
565 | parse_list("dddddcc", '|', ptr, &vp->x, &vp->y, &vp->width, | 566 | if (!(ptr = parse_list("dddddcc", '|', ptr, &vp->x, &vp->y, &vp->width, |
566 | &vp->height, &vp->font, &vp->fg_pattern,&vp->bg_pattern); | 567 | &vp->height, &vp->font, &vp->fg_pattern,&vp->bg_pattern))) |
568 | return WPS_ERROR_INVALID_PARAM; | ||
567 | } | 569 | } |
568 | else | 570 | else |
569 | #endif | 571 | #endif |
570 | #if (LCD_DEPTH == 2) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 2) | 572 | #if (LCD_DEPTH == 2) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 2) |
571 | if (depth == 2) { | 573 | if (depth == 2) { |
572 | parse_list("dddddgg", '|', ptr, &vp->x, &vp->y, &vp->width, | 574 | if (!(ptr = parse_list("dddddgg", '|', ptr, &vp->x, &vp->y, &vp->width, |
573 | &vp->height, &vp->font, &vp->fg_pattern, &vp->bg_pattern); | 575 | &vp->height, &vp->font, &vp->fg_pattern, &vp->bg_pattern))) |
576 | return WPS_ERROR_INVALID_PARAM; | ||
574 | } | 577 | } |
575 | else | 578 | else |
576 | #endif | 579 | #endif |
577 | #if (LCD_DEPTH == 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 1) | 580 | #if (LCD_DEPTH == 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 1) |
578 | if (depth == 1) | 581 | if (depth == 1) |
579 | { | 582 | { |
580 | parse_list("ddddd", '|', ptr, &vp->x, &vp->y, &vp->width, &vp->height, | 583 | if (!(ptr = parse_list("ddddd", '|', ptr, &vp->x, &vp->y, &vp->width, |
581 | &vp->font); | 584 | &vp->height, &vp->font))) |
585 | return WPS_ERROR_INVALID_PARAM; | ||
582 | } | 586 | } |
583 | else | 587 | else |
584 | #endif | 588 | #endif |
585 | {} | 589 | {} |
586 | 590 | ||
591 | /* Check for trailing | */ | ||
592 | if (*ptr != '|') | ||
593 | return WPS_ERROR_INVALID_PARAM; | ||
594 | |||
587 | /* Default to using the user font if the font was an invalid number */ | 595 | /* Default to using the user font if the font was an invalid number */ |
588 | if ((vp->font != FONT_SYSFIXED) && (vp->font != FONT_UI)) | 596 | if ((vp->font != FONT_SYSFIXED) && (vp->font != FONT_UI)) |
589 | vp->font = FONT_UI; | 597 | vp->font = FONT_UI; |