some bugs fixed; closes #13

master
Marc Wäckerlin 13 years ago
parent 73b5f17f9d
commit 41ef264e88
  1. 9
      src/openssl.hxx

@ -379,7 +379,8 @@ namespace openssl {
" certificate the issuer certificate could not be found: this" " certificate the issuer certificate could not be found: this"
" occurs if the issuer certificate of an untrusted certificate" " occurs if the issuer certificate of an untrusted certificate"
" cannot be found."; " cannot be found.";
case X509_V_ERR_UNABLE_TO_GET_CRL: "X509_V_ERR_UNABLE_TO_GET_CRL:" case X509_V_ERR_UNABLE_TO_GET_CRL:
return "X509_V_ERR_UNABLE_TO_GET_CRL:"
" unable to get certificate CRL the CRL of a certificate could" " unable to get certificate CRL the CRL of a certificate could"
" not be found. Unused."; " not be found. Unused.";
case X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE: case X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE:
@ -865,6 +866,10 @@ namespace openssl {
tag and length in the first two char-fields. */ tag and length in the first two char-fields. */
unsigned char* c(0); unsigned char* c(0);
int len(i2d_X509(_x509, &c)); int len(i2d_X509(_x509, &c));
if (len<15 || len<15+c[14]) {
OPENSSL_free(c);
return std::string();
}
std::string res((char*)c+15, c[14]); std::string res((char*)c+15, c[14]);
OPENSSL_free(c); OPENSSL_free(c);
return res; return res;
@ -1317,7 +1322,7 @@ namespace openssl {
TCP& write(const std::string& s) { TCP& write(const std::string& s) {
OPENSSL_LOG("log"); OPENSSL_LOG("log");
if (_bio<=0) throw tcp_closed_connection(); if (_bio<=0) throw tcp_closed_connection();
int x(BIO_write(_bio, s.begin().operator->(), s.size())); unsigned int x(BIO_write(_bio, s.begin().operator->(), s.size()));
if (x<=0) if (x<=0)
if (BIO_should_retry(_bio)) return write(s); if (BIO_should_retry(_bio)) return write(s);
else { else {

Loading…
Cancel
Save