Re: [PATCH] validate tcp port values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/11/2012 02:03 PM, Peter Hatina wrote:
Hi,

I had a request to validate TCP port values in spice-xpi, so
does this make sense for you?

More info at https://bugzilla.redhat.com/show_bug.cgi?id=805602

---
  SpiceXPI/src/plugin/plugin.cpp |   27 +++++++++++++++++++++++++--
  1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/SpiceXPI/src/plugin/plugin.cpp b/SpiceXPI/src/plugin/plugin.cpp
index b7f61ba..4aac37e 100644
--- a/SpiceXPI/src/plugin/plugin.cpp
+++ b/SpiceXPI/src/plugin/plugin.cpp
@@ -581,6 +593,15 @@ void nsPluginInstance::SendStr(uint32_t id, std::string str)

  void nsPluginInstance::Connect()
  {
+    const int port = portToInt(m_port);
+    const int sport = portToInt(m_secure_port);
+    if (port<= 0)
+        g_warning("invalid port: '%s'", m_port.c_str());
+    if (sport<= 0)
+        g_warning("invalid secure port: '%s'", m_secure_port.c_str());
+    if (port<= 0&&  sport<= 0)
+        return;
+

I think simply returning here is not good.
You should also send a "disconnected" (or spice client exited) notification to the caller.

Regards,
    Uri.
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]