Skip to content

Commit 7144f66

Browse files
committed
Fix error handling in port number parsing in the url_builder
1 parent 88a1bcd commit 7144f66

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Release/include/cpprest/uri_builder.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,13 @@ namespace web { namespace http
160160
uri_builder & set_port(const utility::string_t &port)
161161
{
162162
utility::istringstream_t portStream(port);
163-
portStream >> m_uri.m_port;
163+
int port_tmp;
164+
portStream >> port_tmp;
164165
if(portStream.fail() || portStream.bad())
165166
{
166167
throw std::invalid_argument("invalid port argument, must be non empty string containing integer value");
167168
}
168-
169+
m_uri.m_port = port_tmp;
169170
return *this;
170171
}
171172

0 commit comments

Comments
 (0)