diff options
| author | djm <> | 2012-01-05 23:01:39 +0000 |
|---|---|---|
| committer | djm <> | 2012-01-05 23:01:39 +0000 |
| commit | f48d9d4a955d7e4c1c692099ab67e1dbfeb51137 (patch) | |
| tree | 866512933d8f0c1ea5465d0169915b36c1ca3cae /src/lib/libcrypto/bio/bf_buff.c | |
| parent | 35dadfe897866818c3fd0350efefc5caae349fb6 (diff) | |
| download | openbsd-f48d9d4a955d7e4c1c692099ab67e1dbfeb51137.tar.gz openbsd-f48d9d4a955d7e4c1c692099ab67e1dbfeb51137.tar.bz2 openbsd-f48d9d4a955d7e4c1c692099ab67e1dbfeb51137.zip | |
OpenSSL 1.0.0f: merge
Diffstat (limited to 'src/lib/libcrypto/bio/bf_buff.c')
| -rw-r--r-- | src/lib/libcrypto/bio/bf_buff.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/lib/libcrypto/bio/bf_buff.c b/src/lib/libcrypto/bio/bf_buff.c index c1fd75aaad..4b5a132d8a 100644 --- a/src/lib/libcrypto/bio/bf_buff.c +++ b/src/lib/libcrypto/bio/bf_buff.c | |||
| @@ -209,7 +209,7 @@ start: | |||
| 209 | /* add to buffer and return */ | 209 | /* add to buffer and return */ |
| 210 | if (i >= inl) | 210 | if (i >= inl) |
| 211 | { | 211 | { |
| 212 | memcpy(&(ctx->obuf[ctx->obuf_len]),in,inl); | 212 | memcpy(&(ctx->obuf[ctx->obuf_off+ctx->obuf_len]),in,inl); |
| 213 | ctx->obuf_len+=inl; | 213 | ctx->obuf_len+=inl; |
| 214 | return(num+inl); | 214 | return(num+inl); |
| 215 | } | 215 | } |
| @@ -219,7 +219,7 @@ start: | |||
| 219 | { | 219 | { |
| 220 | if (i > 0) /* lets fill it up if we can */ | 220 | if (i > 0) /* lets fill it up if we can */ |
| 221 | { | 221 | { |
| 222 | memcpy(&(ctx->obuf[ctx->obuf_len]),in,i); | 222 | memcpy(&(ctx->obuf[ctx->obuf_off+ctx->obuf_len]),in,i); |
| 223 | in+=i; | 223 | in+=i; |
| 224 | inl-=i; | 224 | inl-=i; |
| 225 | num+=i; | 225 | num+=i; |
| @@ -294,9 +294,9 @@ static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
| 294 | case BIO_C_GET_BUFF_NUM_LINES: | 294 | case BIO_C_GET_BUFF_NUM_LINES: |
| 295 | ret=0; | 295 | ret=0; |
| 296 | p1=ctx->ibuf; | 296 | p1=ctx->ibuf; |
| 297 | for (i=ctx->ibuf_off; i<ctx->ibuf_len; i++) | 297 | for (i=0; i<ctx->ibuf_len; i++) |
| 298 | { | 298 | { |
| 299 | if (p1[i] == '\n') ret++; | 299 | if (p1[ctx->ibuf_off + i] == '\n') ret++; |
| 300 | } | 300 | } |
| 301 | break; | 301 | break; |
| 302 | case BIO_CTRL_WPENDING: | 302 | case BIO_CTRL_WPENDING: |
| @@ -399,17 +399,18 @@ static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
| 399 | for (;;) | 399 | for (;;) |
| 400 | { | 400 | { |
| 401 | BIO_clear_retry_flags(b); | 401 | BIO_clear_retry_flags(b); |
| 402 | if (ctx->obuf_len > ctx->obuf_off) | 402 | if (ctx->obuf_len > 0) |
| 403 | { | 403 | { |
| 404 | r=BIO_write(b->next_bio, | 404 | r=BIO_write(b->next_bio, |
| 405 | &(ctx->obuf[ctx->obuf_off]), | 405 | &(ctx->obuf[ctx->obuf_off]), |
| 406 | ctx->obuf_len-ctx->obuf_off); | 406 | ctx->obuf_len); |
| 407 | #if 0 | 407 | #if 0 |
| 408 | fprintf(stderr,"FLUSH [%3d] %3d -> %3d\n",ctx->obuf_off,ctx->obuf_len-ctx->obuf_off,r); | 408 | fprintf(stderr,"FLUSH [%3d] %3d -> %3d\n",ctx->obuf_off,ctx->obuf_len,r); |
| 409 | #endif | 409 | #endif |
| 410 | BIO_copy_next_retry(b); | 410 | BIO_copy_next_retry(b); |
| 411 | if (r <= 0) return((long)r); | 411 | if (r <= 0) return((long)r); |
| 412 | ctx->obuf_off+=r; | 412 | ctx->obuf_off+=r; |
| 413 | ctx->obuf_len-=r; | ||
| 413 | } | 414 | } |
| 414 | else | 415 | else |
| 415 | { | 416 | { |
