}
#ifndef CURL_DISABLE_CRYPTO_AUTH
else if((pop3c->authtypes & POP3_TYPE_APOP) &&
- (pop3c->preftype & POP3_TYPE_APOP))
+ (pop3c->preftype & POP3_TYPE_APOP) &&
+ (pop3c->apoptimestamp))
/* Perform APOP authentication */
result = pop3_perform_apop(conn);
#endif
if(line[i] == '<') {
/* Calculate the length of the timestamp */
size_t timestamplen = len - 2 - i;
+ if(!timestamplen)
+ break;
/* Allocate some memory for the timestamp */
pop3c->apoptimestamp = (char *)calloc(1, timestamplen + 1);
}
#ifndef CURL_DISABLE_CRYPTO_AUTH
else if((pop3c->authtypes & POP3_TYPE_APOP) &&
- (pop3c->preftype & POP3_TYPE_APOP))
+ (pop3c->preftype & POP3_TYPE_APOP) &&
+ (pop3c->apoptimestamp))
/* Perform APOP authentication */
result = pop3_perform_apop(conn);
#endif