pike.git / lib / modules / SSL.pmod / Connection.pike

version» Context lines:

pike.git/lib/modules/SSL.pmod/Connection.pike:760:    else    {    SSL3_DEBUG_MSG("SSL.Connection: received packet of type %d\n",    packet->content_type);    switch (packet->content_type)    {    case PACKET_alert:    {    SSL3_DEBUG_MSG("SSL.Connection: ALERT\n");    +  if( !sizeof(packet->fragment) ) +  { +  send_packet(alert(ALERT_fatal, ALERT_unexpected_message, +  "Zero length Alert fragments not allowed.\n")); +  return -1; +  } +     int i;    int err = 0;    alert_buffer += packet->fragment;    for (i = 0;    !err && ((sizeof(alert_buffer) - i) >= 2);    i+= 2)    err = handle_alert(alert_buffer[i..i+1]);       alert_buffer = alert_buffer[i..];    if (err)
pike.git/lib/modules/SSL.pmod/Connection.pike:781:    // If we get a close then we return the data we got so far.    return res;    else    return err;    break;    }    case PACKET_change_cipher_spec:    {    SSL3_DEBUG_MSG("SSL.Connection: CHANGE_CIPHER_SPEC\n");    +  if( !sizeof(packet->fragment) ) +  { +  send_packet(alert(ALERT_fatal, ALERT_unexpected_message, +  "Zero length ChangeCipherSpec fragments not allowed.\n")); +  return -1; +  }    int i;    int err;    for (i = 0; (i < sizeof(packet->fragment)); i++)    {    err = handle_change_cipher(packet->fragment[i]);    SSL3_DEBUG_MSG("tried change_cipher: %d\n", err);    if (err)    return err;    }    break;    }    case PACKET_handshake:    {    SSL3_DEBUG_MSG("SSL.Connection: HANDSHAKE\n");    -  +  if( !sizeof(packet->fragment) ) +  { +  send_packet(alert(ALERT_fatal, ALERT_unexpected_message, +  "Zero length Handshake fragments not allowed.\n")); +  return -1; +  }    if (!(state & CONNECTION_handshaking) &&    !secure_renegotiation) {    // Don't allow renegotiation in unsecure mode, to address    // http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2009-3555.    // For details see: http://www.g-sec.lu/practicaltls.pdf and    // RFC 5746.    send_packet(alert(ALERT_warning, ALERT_no_renegotiation,    "Renegotiation not supported in unsecure mode.\n"));    return -1;    }