int ret;
char *p;
unsigned char *ptr;
- int len;
+ size_t len;
KTEXT_ST adat;
MSG_DAT msg_data;
int checksum;
char *name;
char *p;
char passwd[100];
- int tmp;
+ size_t tmp;
ssize_t nread;
int save;
CURLcode result;
p += 2;
tmp = Curl_base64_decode(p, &ptr);
- if(len > sizeof(tkt.dat)-1) {
+ if(tmp >= sizeof(tkt.dat)) {
free(ptr);
- len=0;
+ tmp=0;
}
- if(!len || !ptr) {
+ if(!tmp || !ptr) {
Curl_failf(conn->data, "Failed to decode base64 in reply.\n");
Curl_set_command_prot(conn, save);
return CURLE_FTP_WEIRD_SERVER_REPLY;
Curl_sec_read_msg(struct connectdata *conn, char *s, int level)
{
int len;
- char *buf;
+ unsigned char *buf;
int code;
- buf = malloc(strlen(s));
- len = Curl_base64_decode(s + 4, buf); /* XXX */
+ len = Curl_base64_decode(s + 4, &buf); /* XXX */
+ if(len > 0)
+ len = (conn->mech->decode)(conn->app_data, buf, len, level, conn);
+ else
+ return -1;
- len = (conn->mech->decode)(conn->app_data, buf, len, level, conn);
if(len < 0) {
free(buf);
return -1;
if(buf[3] == '-')
code = 0;
else
- sscanf(buf, "%d", &code);
+ sscanf((char *)buf, "%d", &code);
if(buf[len-1] == '\n')
buf[len-1] = '\0';
- strcpy(s, buf);
+ strcpy(s, (char *)buf);
free(buf);
return code;
}