[Spice-devel] [PATCH spice-xpi] Validate port values

Marc-André Lureau marcandre.lureau at gmail.com
Wed Apr 4 04:25:16 PDT 2012


On Wed, Apr 4, 2012 at 8:42 AM, Peter Hatina <phatina at redhat.com> wrote:
> The function int portToInt(const std::string &port) returns the values
> from [-1 to 65535], so you would never error out. -1 was meant to be as
> indicator of invalid transport layer port. If both ports are invalid, I
> do not want to launch any process, that will do nothing. So the
> restriction policy, as far as I am concerned, should be like this.

But if -1 is a valid value to parse to indicate that the port
shouldn't be used, you shouldn't say it's an error, like it does with
this patch.

The portToInt() should return another value, like -2, or better use an
exception?

regards


-- 
Marc-André Lureau


More information about the Spice-devel mailing list