projects
/
ejabberd
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1f1a98d
)
Avoid quadratic behavior in reading SSL data
author
Alexey Shchepin
<alexey@process-one.net>
Mon, 20 Feb 2012 15:41:56 +0000
(17:41 +0200)
committer
Paweł Chmielowski
<pchmielowski@process-one.net>
Fri, 6 Apr 2012 09:47:53 +0000
(11:47 +0200)
src/tls/tls_drv.c
patch
|
blob
|
history
diff --git
a/src/tls/tls_drv.c
b/src/tls/tls_drv.c
index dabe1491136ccb0dd4292b1f793d85158531eff9..e680cde65039a854b5166285119843ea456a2a7e 100644
(file)
--- 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)