|
|
ad2f2b |
From b1d8fce69f59581769e5db87e7e20cdc3c27d685 Mon Sep 17 00:00:00 2001
|
|
|
ad2f2b |
From: Tomas Popela <tpopela@redhat.com>
|
|
|
ad2f2b |
Date: Mon, 23 Jul 2018 11:30:54 +0200
|
|
|
ad2f2b |
Subject: [PATCH 09/17] Avoid possible overrun while comparing to MAN_FONTS
|
|
|
ad2f2b |
|
|
|
ad2f2b |
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.
|
|
|
ad2f2b |
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).
|
|
|
ad2f2b |
|
|
|
ad2f2b |
yelp-3.28.1/libyelp/yelp-man-parser.c:476: assignment: Assigning: "k" = "parser->current_font".
|
|
|
ad2f2b |
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.
|
|
|
ad2f2b |
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).
|
|
|
ad2f2b |
---
|
|
|
ad2f2b |
libyelp/yelp-man-parser.c | 4 ++--
|
|
|
ad2f2b |
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
ad2f2b |
|
|
|
ad2f2b |
diff --git a/libyelp/yelp-man-parser.c b/libyelp/yelp-man-parser.c
|
|
|
ad2f2b |
index 8d097820..00e66e00 100644
|
|
|
ad2f2b |
--- a/libyelp/yelp-man-parser.c
|
|
|
ad2f2b |
+++ b/libyelp/yelp-man-parser.c
|
|
|
ad2f2b |
@@ -463,7 +463,7 @@ yelp_man_parser_free (YelpManParser *parser)
|
|
|
ad2f2b |
static void
|
|
|
ad2f2b |
set_font_register (YelpManParser *parser, guint k, const gchar* name)
|
|
|
ad2f2b |
{
|
|
|
ad2f2b |
- if (k > MAN_FONTS) {
|
|
|
ad2f2b |
+ if (k >= MAN_FONTS) {
|
|
|
ad2f2b |
g_warning ("Tried to set nonexistant font register %u to %s",
|
|
|
ad2f2b |
k, name);
|
|
|
ad2f2b |
return;
|
|
|
ad2f2b |
@@ -476,7 +476,7 @@ static const gchar*
|
|
|
ad2f2b |
get_font (const YelpManParser *parser)
|
|
|
ad2f2b |
{
|
|
|
ad2f2b |
guint k = parser->current_font;
|
|
|
ad2f2b |
- if (k > MAN_FONTS ||
|
|
|
ad2f2b |
+ if (k >= MAN_FONTS ||
|
|
|
ad2f2b |
parser->font_registers[k] == NULL) {
|
|
|
ad2f2b |
|
|
|
ad2f2b |
g_warning ("Tried to get nonexistant font register %u", k);
|
|
|
ad2f2b |
--
|
|
|
ad2f2b |
2.19.1
|
|
|
ad2f2b |
|