summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Popela <tpopela@redhat.com>2018-07-23 11:30:54 +0200
committerDavid King <amigadave@amigadave.com>2019-01-21 14:38:59 +0000
commit8b2fab2978b90757d927010dd1faa2840a4e7f07 (patch)
treefdc5d0e849c881f706acd4afd159a94c1dcd2f6e
parent6b05dd2a96f210ea46d057c2c571987adceb1e89 (diff)
downloadyelp-8b2fab2978b90757d927010dd1faa2840a4e7f07.tar.gz
Avoid possible overrun while comparing to MAN_FONTS
yelp-3.28.1/libyelp/yelp-man-parser.c:464: cond_at_most: Checking "k > 8U" implies that "k" may be up to 8 on the false branch. yelp-3.28.1/libyelp/yelp-man-parser.c:469: overrun-local: Overrunning array "parser->font_registers" of 8 8-byte elements at element index 8 (byte offset 64) using index "k" (which evaluates to 8). yelp-3.28.1/libyelp/yelp-man-parser.c:476: assignment: Assigning: "k" = "parser->current_font". yelp-3.28.1/libyelp/yelp-man-parser.c:477: cond_at_most: Checking "k > 8U" implies that "k" and "parser->current_font" may be up to 8 on the false branch. yelp-3.28.1/libyelp/yelp-man-parser.c:477: overrun-local: Overrunning array "parser->font_registers" of 8 8-byte elements at element index 8 (byte offset 64) using index "k" (which evaluates to 8).
-rw-r--r--libyelp/yelp-man-parser.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libyelp/yelp-man-parser.c b/libyelp/yelp-man-parser.c
index 8d097820..00e66e00 100644
--- a/libyelp/yelp-man-parser.c
+++ b/libyelp/yelp-man-parser.c
@@ -463,7 +463,7 @@ yelp_man_parser_free (YelpManParser *parser)
static void
set_font_register (YelpManParser *parser, guint k, const gchar* name)
{
- if (k > MAN_FONTS) {
+ if (k >= MAN_FONTS) {
g_warning ("Tried to set nonexistant font register %u to %s",
k, name);
return;
@@ -476,7 +476,7 @@ static const gchar*
get_font (const YelpManParser *parser)
{
guint k = parser->current_font;
- if (k > MAN_FONTS ||
+ if (k >= MAN_FONTS ||
parser->font_registers[k] == NULL) {
g_warning ("Tried to get nonexistant font register %u", k);