forked from wolfSSL/wolfssl
OCSP tweak to clean warnings from build
This commit is contained in:
12
src/ocsp.c
12
src/ocsp.c
@ -88,7 +88,6 @@ int CyaSSL_OCSP_Init(CYASSL_OCSP* ocsp)
|
|||||||
void CyaSSL_OCSP_Cleanup(CYASSL_OCSP* ocsp)
|
void CyaSSL_OCSP_Cleanup(CYASSL_OCSP* ocsp)
|
||||||
{
|
{
|
||||||
ocsp->enabled = 0;
|
ocsp->enabled = 0;
|
||||||
/* Deallocate memory */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -224,13 +223,14 @@ static int build_ocsp_request(CYASSL_OCSP* ocsp, byte* buf, int bufSz)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static char* decode_http_response(char* buf, int bufSize, int* ocspRespSize)
|
static byte* decode_http_response(byte* httpBuf, int httpBufSz, int* ocspRespSz)
|
||||||
{
|
{
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
int stop = 0;
|
int stop = 0;
|
||||||
byte* contentType = NULL;
|
byte* contentType = NULL;
|
||||||
byte* contentLength = NULL;
|
byte* contentLength = NULL;
|
||||||
byte* content = NULL;
|
byte* content = NULL;
|
||||||
|
char* buf = (char*)httpBuf; /* kludge so I'm not constantly casting */
|
||||||
|
|
||||||
if (strncasecmp(buf, "HTTP/1", 6) != 0)
|
if (strncasecmp(buf, "HTTP/1", 6) != 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -243,7 +243,7 @@ static char* decode_http_response(char* buf, int bufSize, int* ocspRespSize)
|
|||||||
|
|
||||||
idx += 8;
|
idx += 8;
|
||||||
|
|
||||||
while (idx < bufSize && !stop) {
|
while (idx < httpBufSz && !stop) {
|
||||||
if (buf[idx] == '\r' && buf[idx+1] == '\n') {
|
if (buf[idx] == '\r' && buf[idx+1] == '\n') {
|
||||||
stop = 1;
|
stop = 1;
|
||||||
idx += 2;
|
idx += 2;
|
||||||
@ -261,11 +261,11 @@ static char* decode_http_response(char* buf, int bufSize, int* ocspRespSize)
|
|||||||
int len = 0;
|
int len = 0;
|
||||||
idx += 15;
|
idx += 15;
|
||||||
if (buf[idx] == ' ') idx++;
|
if (buf[idx] == ' ') idx++;
|
||||||
while (buf[idx] > '0' && buf[idx] < '9' && idx < bufSize) {
|
while (buf[idx] > '0' && buf[idx] < '9' && idx < httpBufSz) {
|
||||||
len = (len * 10) + (buf[idx] - '0');
|
len = (len * 10) + (buf[idx] - '0');
|
||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
*ocspRespSize = len;
|
*ocspRespSz = len;
|
||||||
idx += 2; /* skip the crlf */
|
idx += 2; /* skip the crlf */
|
||||||
} else {
|
} else {
|
||||||
/* Advance idx past the next \r\n */
|
/* Advance idx past the next \r\n */
|
||||||
@ -275,7 +275,7 @@ static char* decode_http_response(char* buf, int bufSize, int* ocspRespSize)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return &buf[idx];
|
return &httpBuf[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user