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