1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
diff --git a/lib/krb5.c b/lib/krb5.c
index b041d2f227..33655ec1c9 100644
--- a/lib/krb5.c
+++ b/lib/krb5.c
@@ -525,46 +525,47 @@ socket_write(struct Curl_easy *data, int sockindex, const void *to,
static CURLcode krb5_read_data(struct Curl_easy *data, int sockindex,
struct krb5buffer *buf)
{
struct connectdata *conn = data->conn;
- int len;
+ uint32_t len;
CURLcode result;
- int nread;
+ size_t nread;
+ int rc;
result = socket_read(data, sockindex, &len, sizeof(len));
if(result)
return result;
if(len) {
- len = (int)ntohl((uint32_t)len);
+ len = ntohl(len);
if(len > CURL_MAX_INPUT_LENGTH)
return CURLE_TOO_LARGE;
curlx_dyn_reset(&buf->buf);
}
else
return CURLE_RECV_ERROR;
do {
char buffer[1024];
- nread = CURLMIN(len, (int)sizeof(buffer));
- result = socket_read(data, sockindex, buffer, (size_t)nread);
+ nread = CURLMIN(len, sizeof(buffer));
+ result = socket_read(data, sockindex, buffer, nread);
if(result)
return result;
result = curlx_dyn_addn(&buf->buf, buffer, nread);
if(result)
return result;
- len -= nread;
+ len -= (uint32_t)nread;
} while(len);
/* this decodes the dynbuf *in place* */
- nread = conn->mech->decode(conn->app_data,
- curlx_dyn_ptr(&buf->buf),
- len, conn->data_prot, conn);
- if(nread < 0)
+ rc = conn->mech->decode(conn->app_data, curlx_dyn_ptr(&buf->buf),
+ (int)curlx_dyn_len(&buf->buf), conn->data_prot,
+ conn);
+ if(rc < 0)
return CURLE_RECV_ERROR;
- curlx_dyn_setlen(&buf->buf, nread);
+ curlx_dyn_setlen(&buf->buf, rc);
buf->index = 0;
return CURLE_OK;
}
static size_t
|