Skip to content

Commit

Permalink
Resolve problems with psrp issues #437,#438,#439
Browse files Browse the repository at this point in the history
Issues fixed:

Issue #437: Buffer overrun in httpclient.c - _CreateHttpHeader
Issue #438: Cannot enable libmi logging on psrp client using v1.4.0-6
Issue #439: httpclient.c:_RequestCallbackWrite not handling partial sends.
  • Loading branch information
Bruce Campbell authored and jeffaco committed Nov 13, 2017
1 parent 62bc7f5 commit 1770fbe
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Unix/base/paths.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ static PathInfo _paths[] =
{ "httpclientsendtracefile", HTTPCLIENTSENDTRACEFILE, MI_FALSE },
{ "httpclientrecvtracefile", HTTPCLIENTRECVTRACEFILE, MI_FALSE },
{ "srcdir", CONFIG_SRCDIR, MI_FALSE },
{ "credsdir", CONFIG_CREDSDIR, MI_FALSE },
{ "keytabfile", KRB5_KEYTABPATH, MI_FALSE },
{ "clientconfigfile", CLIENTCONFIGFILE, MI_FALSE },
{ "credsdir", CONFIG_CREDSDIR, MI_FALSE }
};

#include <pal/ownedmemory.h>
Expand Down
5 changes: 3 additions & 2 deletions Unix/base/paths.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ typedef enum _PathID
ID_HTTPCLIENTSENDTRACEFILE,
ID_HTTPCLIENTRECVTRACEFILE,
ID_SRCDIR,
ID_KRB5_KEYTABPATH,
ID_CLIENTCONFIGFILE,
ID_KRB5_KEYTABPATH
ID_CREDSDIR
}
PathID;

Expand All @@ -60,7 +61,7 @@ void PrintPaths();

/* Set path form nickname (e.g., "prefix", "libdir") */
int SetPathFromNickname(
const char* nickname,
const char* nickname,
const char* path);

MI_Boolean IsNickname(const char* nickname);
Expand Down
15 changes: 8 additions & 7 deletions Unix/http/httpclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -1163,18 +1163,18 @@ Http_CallbackResult _WriteClientHeader(HttpClient_SR_SocketData* handler)
size_t buf_size, sent;
MI_Result r;

/* Do we have any data to send? */
if (!handler->sendHeader)
{
goto Error;
}

/* are we done with header? */
if (handler->sendingState == RECV_STATE_CONTENT)
{
return PRT_CONTINUE;
}

/* Do we have any data to send? */
if (!handler->sendHeader)
{
goto Error;
}

LOGD2((ZT("_WriteHeader - Begin")));

#if ENCRYPT_DECRYPT
Expand Down Expand Up @@ -1969,7 +1969,8 @@ Page* _CreateHttpHeader(
SizeTAdd(pageSize, uri_len, &pageSize) != S_OK ||
SizeTAdd(pageSize, sizeof(Page), &pageSize) != S_OK ||
(contentType && SizeTAdd(pageSize, Strlen(contentType), &pageSize) != S_OK) ||
(authHeader && SizeTAdd(pageSize, Strlen(authHeader), &pageSize) != S_OK) )
(authHeader && SizeTAdd(pageSize, Strlen(authHeader), &pageSize) != S_OK) ||
SizeTAdd(pageSize, 2, &pageSize) != S_OK )
{
// Overflow
return 0;
Expand Down

0 comments on commit 1770fbe

Please sign in to comment.