inetcomm: Prevent possible dereferences (Coverity).

This commit is contained in:
Paul Vriens 2009-05-14 09:18:08 +02:00 committed by Alexandre Julliard
parent 81a9f4a357
commit e7f4f3b69c
1 changed files with 6 additions and 3 deletions

View File

@ -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;