提交 77202a85 编写于 作者: D Dr. Stephen Henson

Update from stable branch.

上级 73bfcf22
...@@ -745,6 +745,10 @@ ...@@ -745,6 +745,10 @@
Changes between 0.9.8j and 0.9.8k [xx XXX xxxx] Changes between 0.9.8j and 0.9.8k [xx XXX xxxx]
*) Improve efficiency of mem_gets: don't search whole buffer each time
for a '\n'
[Jeremy Shapiro <jnshapir@us.ibm.com>]
*) New -hex option for openssl rand. *) New -hex option for openssl rand.
[Matthieu Herrb] [Matthieu Herrb]
......
...@@ -280,6 +280,7 @@ static int mem_gets(BIO *bp, char *buf, int size) ...@@ -280,6 +280,7 @@ static int mem_gets(BIO *bp, char *buf, int size)
BIO_clear_retry_flags(bp); BIO_clear_retry_flags(bp);
j=bm->length; j=bm->length;
if ((size-1) < j) j=size-1;
if (j <= 0) if (j <= 0)
{ {
*buf='\0'; *buf='\0';
...@@ -288,17 +289,18 @@ static int mem_gets(BIO *bp, char *buf, int size) ...@@ -288,17 +289,18 @@ static int mem_gets(BIO *bp, char *buf, int size)
p=bm->data; p=bm->data;
for (i=0; i<j; i++) for (i=0; i<j; i++)
{ {
if (p[i] == '\n') break; if (p[i] == '\n')
} {
if (i == j) i++;
{ break;
BIO_set_retry_read(bp); }
/* return(-1); change the semantics 0.6.6a */
} }
else
i++; /*
/* i is the max to copy */ * i is now the max num of bytes to copy, either j or up to
if ((size-1) < i) i=size-1; * and including the first newline
*/
i=mem_read(bp,buf,i); i=mem_read(bp,buf,i);
if (i > 0) buf[i]='\0'; if (i > 0) buf[i]='\0';
ret=i; ret=i;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册