Commit e7f4f3b6 authored by Paul Vriens's avatar Paul Vriens Committed by Alexandre Julliard

inetcomm: Prevent possible dereferences (Coverity).

parent 81a9f4a3
......@@ -732,7 +732,7 @@ static HRESULT WINAPI SMTPTransport_CommandMAIL(ISMTPTransport2 *iface, LPSTR ps
SMTPTransport *This = (SMTPTransport *)iface;
const char szCommandFormat[] = "MAIL FROM: <%s>\n";
char *szCommand;
int len = sizeof(szCommandFormat) - 2 /* "%s" */ + strlen(pszEmailFrom);
int len;
HRESULT hr;
TRACE("(%s)\n", debugstr_a(pszEmailFrom));
......@@ -740,6 +740,7 @@ static HRESULT WINAPI SMTPTransport_CommandMAIL(ISMTPTransport2 *iface, LPSTR ps
if (!pszEmailFrom)
return E_INVALIDARG;
len = sizeof(szCommandFormat) - 2 /* "%s" */ + strlen(pszEmailFrom);
szCommand = HeapAlloc(GetProcessHeap(), 0, len);
if (!szCommand)
return E_OUTOFMEMORY;
......@@ -758,7 +759,7 @@ static HRESULT WINAPI SMTPTransport_CommandRCPT(ISMTPTransport2 *iface, LPSTR ps
SMTPTransport *This = (SMTPTransport *)iface;
const char szCommandFormat[] = "RCPT TO: <%s>\n";
char *szCommand;
int len = sizeof(szCommandFormat) - 2 /* "%s" */ + strlen(pszEmailTo);
int len;
HRESULT hr;
TRACE("(%s)\n", debugstr_a(pszEmailTo));
......@@ -766,6 +767,7 @@ static HRESULT WINAPI SMTPTransport_CommandRCPT(ISMTPTransport2 *iface, LPSTR ps
if (!pszEmailTo)
return E_INVALIDARG;
len = sizeof(szCommandFormat) - 2 /* "%s" */ + strlen(pszEmailTo);
szCommand = HeapAlloc(GetProcessHeap(), 0, len);
if (!szCommand)
return E_OUTOFMEMORY;
......@@ -833,7 +835,7 @@ static HRESULT WINAPI SMTPTransport_CommandAUTH(ISMTPTransport2 *iface,
SMTPTransport *This = (SMTPTransport *)iface;
const char szCommandFormat[] = "AUTH %s\n";
char *szCommand;
int len = sizeof(szCommandFormat) - 2 /* "%s" */ + strlen(pszAuthType);
int len;
HRESULT hr;
TRACE("(%s)\n", debugstr_a(pszAuthType));
......@@ -841,6 +843,7 @@ static HRESULT WINAPI SMTPTransport_CommandAUTH(ISMTPTransport2 *iface,
if (!pszAuthType)
return E_INVALIDARG;
len = sizeof(szCommandFormat) - 2 /* "%s" */ + strlen(pszAuthType);
szCommand = HeapAlloc(GetProcessHeap(), 0, len);
if (!szCommand)
return E_OUTOFMEMORY;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment