Marc-André Lureau píše v Út 03. 04. 2012 v 08:39 -0400: > > ----- Mensaje original ----- > > + if (port < 0 && sport < 0) > > + { > > + if (port < 0) > > + LOG_ERROR("invalid port: " << m_port); > > + if (sport < 0) > > + LOG_ERROR("invalid secure port: " << m_secure_port); > > + return; > > + } > > If one of the value is invalid or garbage and the second is valid, you will > silently ignore the error and continue.
Yeah, the workflow should be a little different: 1) for port and sport, convert string to int. It can have three results: 1. port is int in valid range 2. string has zero length -> value should not be sent at all 3. string is garbage 2) connect function should have IMO these paths: 1. both values are valid -> execute client and pass the values to it 2. one of values is valid and the other is disabled -> execute the client and pass the valid value to it 3. one of values is valid: execute the client and: 1. if the other is disabled -> ignore it 2. the other is garbage -> LOG_ERROR the original string value 4. neither of the values is valid -> LOG_ERROR the original string values and don't bother to start the client. in case of 2) 4., it would make a lot of sense to pass the error to the web page too when it is possible (when OnDisconnected will work). David > I think if any value is wrong (not within -1..65535, it should error out) > _______________________________________________ > Spice-devel mailing list > Spice-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/spice-devel -- David Jaša, RHCE SPICE QE based in Brno GPG Key: 22C33E24 Fingerprint: 513A 060B D1B4 2A72 7F0D 0278 B125 CD00 22C3 3E24 _______________________________________________ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel