Blame SOURCES/0001-Escape-special-characters-in-html-output.patch

bd7bb7
From d17b62d7fca7647a1e935285869b93856c924890 Mon Sep 17 00:00:00 2001
bd7bb7
From: Petr Oros <poros@redhat.com>
bd7bb7
Date: Tue, 15 Aug 2017 09:18:02 +0200
bd7bb7
Subject: [PATCH 1/1] Escape special characters in html output
bd7bb7
bd7bb7
Signed-off-by Petr Oros <poros@redhat.com>
bd7bb7
---
bd7bb7
 src/core/print.cc | 77 +++++++++++++++++++++++++++++++++++++++----------------
bd7bb7
 1 file changed, 55 insertions(+), 22 deletions(-)
bd7bb7
bd7bb7
diff --git a/src/core/print.cc b/src/core/print.cc
bd7bb7
index 5df078e..958bf6a 100644
bd7bb7
--- a/src/core/print.cc
bd7bb7
+++ b/src/core/print.cc
bd7bb7
@@ -156,10 +156,13 @@ int level)
bd7bb7
         cout << "";
bd7bb7
       cout << "handle: ";
bd7bb7
       if (html)
bd7bb7
+      {
bd7bb7
         cout << "";
bd7bb7
-      cout << node.getHandle();
bd7bb7
-      if (html)
bd7bb7
+        cout << escape(node.getHandle());
bd7bb7
         cout << "";
bd7bb7
+      }
bd7bb7
+      else
bd7bb7
+        cout << node.getHandle()
bd7bb7
       cout << endl;
bd7bb7
     }
bd7bb7
 #endif
bd7bb7
@@ -174,10 +177,13 @@ int level)
bd7bb7
         cout << "";
bd7bb7
       cout << _("description") << ": ";
bd7bb7
       if (html)
bd7bb7
+      {
bd7bb7
         cout << "";
bd7bb7
-      cout << node.getDescription();
bd7bb7
-      if (html)
bd7bb7
+        cout << escape(node.getDescription());
bd7bb7
         cout << "";
bd7bb7
+      }
bd7bb7
+      else
bd7bb7
+        cout << node.getDescription();
bd7bb7
       cout << endl;
bd7bb7
     }
bd7bb7
 
bd7bb7
@@ -188,10 +194,13 @@ int level)
bd7bb7
         cout << "";
bd7bb7
       cout << _("product") << ": ";
bd7bb7
       if (html)
bd7bb7
+      {
bd7bb7
         cout << "";
bd7bb7
-      cout << node.getProduct();
bd7bb7
-      if (html)
bd7bb7
+        cout << escape(node.getProduct());
bd7bb7
         cout << "";
bd7bb7
+      }
bd7bb7
+      else
bd7bb7
+        cout << node.getProduct();
bd7bb7
       cout << endl;
bd7bb7
     }
bd7bb7
 
bd7bb7
@@ -202,10 +211,13 @@ int level)
bd7bb7
         cout << "";
bd7bb7
       cout << _("vendor") << ": ";
bd7bb7
       if (html)
bd7bb7
+      {
bd7bb7
         cout << "";
bd7bb7
-      cout << node.getVendor();
bd7bb7
-      if (html)
bd7bb7
+        cout << escape(node.getVendor());
bd7bb7
         cout << "";
bd7bb7
+      }
bd7bb7
+      else
bd7bb7
+        cout << node.getVendor();
bd7bb7
       cout << endl;
bd7bb7
     }
bd7bb7
 
bd7bb7
@@ -216,10 +228,13 @@ int level)
bd7bb7
         cout << "";
bd7bb7
       cout << _("physical id") << ": ";
bd7bb7
       if (html)
bd7bb7
+      {
bd7bb7
         cout << "
";
bd7bb7
-      cout << node.getPhysId();
bd7bb7
-      if (html)
bd7bb7
+        cout << escape(node.getPhysId());
bd7bb7
         cout << "";
bd7bb7
+      }
bd7bb7
+      else
bd7bb7
+        cout << node.getPhysId();
bd7bb7
       cout << endl;
bd7bb7
     }
bd7bb7
 
bd7bb7
@@ -230,10 +245,13 @@ int level)
bd7bb7
         cout << "";
bd7bb7
       cout << _("bus info") << ": ";
bd7bb7
       if (html)
bd7bb7
+      {
bd7bb7
         cout << "
";
bd7bb7
-      cout << node.getBusInfo();
bd7bb7
-      if (html)
bd7bb7
+        cout << escape(node.getBusInfo());
bd7bb7
         cout << "";
bd7bb7
+      }
bd7bb7
+      else
bd7bb7
+        cout << node.getBusInfo();
bd7bb7
       cout << endl;
bd7bb7
     }
bd7bb7
 
bd7bb7
@@ -248,10 +266,13 @@ int level)
bd7bb7
           cout << "";
bd7bb7
         cout << _("logical name") << ": ";
bd7bb7
         if (html)
bd7bb7
+        {
bd7bb7
           cout << "
";
bd7bb7
-        cout << logicalnames[i];
bd7bb7
-        if (html)
bd7bb7
+          cout << escape(logicalnames[i]);
bd7bb7
           cout << "";
bd7bb7
+        }
bd7bb7
+        else
bd7bb7
+          cout << logicalnames[i];
bd7bb7
         cout << endl;
bd7bb7
       }
bd7bb7
     }
bd7bb7
@@ -263,10 +284,13 @@ int level)
bd7bb7
         cout << "";
bd7bb7
       cout << _("version") << ": ";
bd7bb7
       if (html)
bd7bb7
+      {
bd7bb7
         cout << "";
bd7bb7
-      cout << node.getVersion();
bd7bb7
-      if (html)
bd7bb7
+        cout << escape(node.getVersion());
bd7bb7
         cout << "";
bd7bb7
+      }
bd7bb7
+      else
bd7bb7
+        cout << node.getVersion();
bd7bb7
       cout << endl;
bd7bb7
     }
bd7bb7
 
bd7bb7
@@ -277,10 +301,13 @@ int level)
bd7bb7
         cout << "";
bd7bb7
       cout << _("date") << ": ";
bd7bb7
       if (html)
bd7bb7
+      {
bd7bb7
         cout << "";
bd7bb7
-      cout << node.getDate();
bd7bb7
-      if (html)
bd7bb7
+        cout << escape(node.getDate());
bd7bb7
         cout << "";
bd7bb7
+      }
bd7bb7
+      else
bd7bb7
+        cout << node.getDate();
bd7bb7
       cout << endl;
bd7bb7
     }
bd7bb7
 
bd7bb7
@@ -291,10 +318,13 @@ int level)
bd7bb7
         cout << "";
bd7bb7
       cout << _("serial") << ": ";
bd7bb7
       if (html)
bd7bb7
+      {
bd7bb7
         cout << "";
bd7bb7
-      cout << (enabled("output:sanitize")?REMOVED:node.getSerial());
bd7bb7
-      if (html)
bd7bb7
+        cout << escape(enabled("output:sanitize")?REMOVED:node.getSerial());
bd7bb7
         cout << "";
bd7bb7
+      }
bd7bb7
+      else
bd7bb7
+        cout << (enabled("output:sanitize")?REMOVED:node.getSerial());
bd7bb7
       cout << endl;
bd7bb7
     }
bd7bb7
 
bd7bb7
@@ -305,10 +335,13 @@ int level)
bd7bb7
         cout << "";
bd7bb7
       cout << _("slot") << ": ";
bd7bb7
       if (html)
bd7bb7
+      {
bd7bb7
         cout << "";
bd7bb7
-      cout << node.getSlot();
bd7bb7
-      if (html)
bd7bb7
+        cout << escape(node.getSlot());
bd7bb7
         cout << "";
bd7bb7
+      }
bd7bb7
+      else
bd7bb7
+        cout << node.getSlot();
bd7bb7
       cout << endl;
bd7bb7
     }
bd7bb7
 
bd7bb7
-- 
bd7bb7
2.14.1
bd7bb7