mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

Blame SOURCES/0182-p2v-Chomp-kernel-command-line-fix-RHBZ-1229340.patch

ffd6ed
From b34585b2a2998ade39c9a3ab119f396d67c051f3 Mon Sep 17 00:00:00 2001
ffd6ed
From: "Richard W.M. Jones" <rjones@redhat.com>
ffd6ed
Date: Tue, 9 Jun 2015 14:09:55 +0100
ffd6ed
Subject: [PATCH] p2v: Chomp kernel command line (fix) (RHBZ#1229340).
ffd6ed
ffd6ed
Calculate the length of the string, not the length of the buffer.
ffd6ed
ffd6ed
This fixes commit 6114c10df05cdb1662ac22930010fd45714f9c40.
ffd6ed
ffd6ed
(cherry picked from commit fc554d422a95f0cef21073a3a8ba0b2d8ddbab45)
ffd6ed
---
ffd6ed
 p2v/main.c | 5 +++++
ffd6ed
 1 file changed, 5 insertions(+)
ffd6ed
ffd6ed
diff --git a/p2v/main.c b/p2v/main.c
ffd6ed
index fd9c156..2dba1b8 100644
ffd6ed
--- a/p2v/main.c
ffd6ed
+++ b/p2v/main.c
ffd6ed
@@ -517,6 +517,11 @@ read_cmdline (void)
ffd6ed
     return NULL;
ffd6ed
   }
ffd6ed
 
ffd6ed
+  /* 'len' is not the length of the string, but the length of the
ffd6ed
+   * buffer.  We need to chomp the string.
ffd6ed
+   */
ffd6ed
+  len = strlen (ret);
ffd6ed
+
ffd6ed
   if (len >= 1 && ret[len-1] == '\n')
ffd6ed
     ret[len-1] = '\0';
ffd6ed
 
ffd6ed
-- 
ffd6ed
1.8.3.1
ffd6ed