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

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