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