Blame SOURCES/0031-Strdup-the-right-place-in-title-extraction.patch

56d25d
From ea7810cf3f9abe63222b50424cab0684994daeea Mon Sep 17 00:00:00 2001
775cb0
From: Jan Stancek <jstancek@redhat.com>
775cb0
Date: Tue, 11 Nov 2014 10:44:09 -0500
56d25d
Subject: [PATCH 31/41] Strdup the right place in title extraction.
775cb0
775cb0
Instead of strduping and then incrementing, which means we free the
775cb0
wrong location, strdup the incremented pointer.
775cb0
775cb0
Resolves: rhbz#1152152
775cb0
775cb0
Signed-off-by: Peter Jones <pjones@redhat.com>
775cb0
---
775cb0
 grubby.c | 5 ++---
775cb0
 1 file changed, 2 insertions(+), 3 deletions(-)
775cb0
775cb0
diff --git a/grubby.c b/grubby.c
56d25d
index 82a0f15..f7209a9 100644
775cb0
--- a/grubby.c
775cb0
+++ b/grubby.c
56d25d
@@ -821,11 +821,10 @@ static int isEntryStart(struct singleLine * line,
775cb0
 
775cb0
 /* extract the title from within brackets (for zipl) */
775cb0
 static char * extractTitle(struct singleLine * line) {
775cb0
-    /* bracketed title... let's extract it (leaks a byte) */
775cb0
+    /* bracketed title... let's extract it */
775cb0
     char * title = NULL;
775cb0
     if (line->type == LT_TITLE) {
775cb0
-	title = strdup(line->elements[0].item);
775cb0
-	title++;
775cb0
+	title = strdup(line->elements[0].item + 1);
775cb0
 	*(title + strlen(title) - 1) = '\0';
775cb0
     } else if (line->type == LT_MENUENTRY)
775cb0
 	title = strdup(line->elements[1].item);
775cb0
-- 
56d25d
2.4.3
775cb0