projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
x86_64 assembly pack: improve masm support.
[openssl.git]
/
crypto
/
bio
/
bf_buff.c
diff --git
a/crypto/bio/bf_buff.c
b/crypto/bio/bf_buff.c
index 1cecd70579569f50b64a0e431ca5bf00358b74bd..4b5a132d8a18320dab2f78ea7f41378d4456f7c0 100644
(file)
--- a/
crypto/bio/bf_buff.c
+++ b/
crypto/bio/bf_buff.c
@@
-209,7
+209,7
@@
start:
/* add to buffer and return */
if (i >= inl)
{
/* add to buffer and return */
if (i >= inl)
{
- memcpy(&(ctx->obuf[ctx->obuf_len]),in,inl);
+ memcpy(&(ctx->obuf[ctx->obuf_
off+ctx->obuf_
len]),in,inl);
ctx->obuf_len+=inl;
return(num+inl);
}
ctx->obuf_len+=inl;
return(num+inl);
}
@@
-219,7
+219,7
@@
start:
{
if (i > 0) /* lets fill it up if we can */
{
{
if (i > 0) /* lets fill it up if we can */
{
- memcpy(&(ctx->obuf[ctx->obuf_len]),in,i);
+ memcpy(&(ctx->obuf[ctx->obuf_
off+ctx->obuf_
len]),in,i);
in+=i;
inl-=i;
num+=i;
in+=i;
inl-=i;
num+=i;
@@
-294,9
+294,9
@@
static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr)
case BIO_C_GET_BUFF_NUM_LINES:
ret=0;
p1=ctx->ibuf;
case BIO_C_GET_BUFF_NUM_LINES:
ret=0;
p1=ctx->ibuf;
- for (i=
ctx->ibuf_off
; i<ctx->ibuf_len; i++)
+ for (i=
0
; i<ctx->ibuf_len; i++)
{
{
- if (p1[i] == '\n') ret++;
+ if (p1[
ctx->ibuf_off +
i] == '\n') ret++;
}
break;
case BIO_CTRL_WPENDING:
}
break;
case BIO_CTRL_WPENDING:
@@
-399,17
+399,18
@@
static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr)
for (;;)
{
BIO_clear_retry_flags(b);
for (;;)
{
BIO_clear_retry_flags(b);
- if (ctx->obuf_len >
ctx->obuf_off
)
+ if (ctx->obuf_len >
0
)
{
r=BIO_write(b->next_bio,
&(ctx->obuf[ctx->obuf_off]),
{
r=BIO_write(b->next_bio,
&(ctx->obuf[ctx->obuf_off]),
- ctx->obuf_len
-ctx->obuf_off
);
+ ctx->obuf_len);
#if 0
#if 0
-fprintf(stderr,"FLUSH [%3d] %3d -> %3d\n",ctx->obuf_off,ctx->obuf_len
-ctx->obuf_off
,r);
+fprintf(stderr,"FLUSH [%3d] %3d -> %3d\n",ctx->obuf_off,ctx->obuf_len,r);
#endif
BIO_copy_next_retry(b);
if (r <= 0) return((long)r);
ctx->obuf_off+=r;
#endif
BIO_copy_next_retry(b);
if (r <= 0) return((long)r);
ctx->obuf_off+=r;
+ ctx->obuf_len-=r;
}
else
{
}
else
{
@@
-494,6
+495,7
@@
static int buffer_gets(BIO *b, char *buf, int size)
if (i <= 0)
{
BIO_copy_next_retry(b);
if (i <= 0)
{
BIO_copy_next_retry(b);
+ *buf='\0';
if (i < 0) return((num > 0)?num:i);
if (i == 0) return(num);
}
if (i < 0) return((num > 0)?num:i);
if (i == 0) return(num);
}