static bool read_data_block(unsigned char *buffer, ssize_t maxlen,
ssize_t *buffer_len)
{
+ curl_off_t value;
+ const char *endp;
+
if(!read_stdin(buffer, 5))
return FALSE;
buffer[5] = '\0';
- /* !checksrc! disable BANNEDFUNC 1 */
- *buffer_len = (ssize_t)strtol((char *)buffer, NULL, 16);
+ endp = (char *)buffer;
+ if(curlx_str_hex(&endp, &value, 0xfffff)) {
+ logmsg("Failed to decode buffer size");
+ return FALSE;
+ }
+ *buffer_len = (ssize_t)value;
if(*buffer_len > maxlen) {
logmsg("Buffer size (%zd bytes) too small for data size error "
"(%zd bytes)", maxlen, *buffer_len);
static char doc[MAXDOCNAMELEN];
if(sscanf(req->reqbuf, "CONNECT %" MAXDOCNAMELEN_TXT "s HTTP/%d.%d",
doc, &prot_major, &prot_minor) == 3) {
- char *portp = NULL;
+ const char *portp = NULL;
logmsg("Received a CONNECT %s HTTP/%d.%d request",
doc, prot_major, prot_minor);
req->open = FALSE; /* HTTP 1.0 closes connection by default */
if(doc[0] == '[') {
- char *p = &doc[1];
- unsigned long part = 0;
+ const char *p = &doc[1];
+ curl_off_t part = 0;
/* scan through the hexgroups and store the value of the last group
in the 'part' variable and use as test case number!! */
while(*p && (ISXDIGIT(*p) || (*p == ':') || (*p == '.'))) {
- char *endp;
- /* !checksrc! disable BANNEDFUNC 1 */
- part = strtoul(p, &endp, 16);
- if(ISXDIGIT(*p))
+ const char *endp = p;
+ if(!curlx_str_hex(&endp, &part, 0xffff))
p = endp;
else
p++;
else
portp = p + 1;
- req->testno = part;
+ req->testno = (long)part;
}
else
portp = strchr(doc, ':');