diff options
author | Alexey Shchepin <alexey@process-one.net> | 2012-02-20 17:41:56 +0200 |
---|---|---|
committer | Paweł Chmielowski <pchmielowski@process-one.net> | 2012-04-06 11:47:53 +0200 |
commit | 4637e2c66b1e23f9aade78a9831b58fe53ee9676 (patch) | |
tree | a5653535ea3c4b8f5567492d75c4f6ce15f6d8ec /src/tls | |
parent | Properly handle HEAD request in mod_http_bind (this fixes EJAB-1538) (diff) |
Avoid quadratic behavior in reading SSL data
Diffstat (limited to 'src/tls')
-rw-r--r-- | src/tls/tls_drv.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/tls/tls_drv.c b/src/tls/tls_drv.c index dabe14911..e680cde65 100644 --- a/src/tls/tls_drv.c +++ b/src/tls/tls_drv.c @@ -442,8 +442,10 @@ static ErlDrvSSizeT tls_drv_control(ErlDrvData handle, { //printf("%d bytes of decrypted data read from state machine\r\n",res); rlen += res; - size += BUF_SIZE; - b = driver_realloc_binary(b, size); + if (size - rlen < BUF_SIZE) { + size *= 2; + b = driver_realloc_binary(b, size); + } } if (res < 0) |