From c16388ade30b26d383bcb9dd3d402e7e74221979 Mon Sep 17 00:00:00 2001 From: XMRig Date: Sun, 2 Jul 2017 23:35:06 +0300 Subject: [PATCH] Fix possibility crash --- src/net/Url.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/net/Url.cpp b/src/net/Url.cpp index 06e44aaae..82b788d9d 100644 --- a/src/net/Url.cpp +++ b/src/net/Url.cpp @@ -146,6 +146,10 @@ bool Url::setUserpass(const char *userpass) void Url::setPassword(const char *password) { + if (!password) { + return; + } + free(m_password); m_password = strdup(password); } @@ -153,6 +157,10 @@ void Url::setPassword(const char *password) void Url::setUser(const char *user) { + if (!user) { + return; + } + free(m_user); m_user = strdup(user); }