diff options
Diffstat (limited to 'src/lib/libcrypto/bio')
| -rw-r--r-- | src/lib/libcrypto/bio/bss_mem.c | 22 | ||||
| -rw-r--r-- | src/lib/libcrypto/bio/bss_sock.c | 5 |
2 files changed, 17 insertions, 10 deletions
diff --git a/src/lib/libcrypto/bio/bss_mem.c b/src/lib/libcrypto/bio/bss_mem.c index a4edb711ae..e7ab9cb3a3 100644 --- a/src/lib/libcrypto/bio/bss_mem.c +++ b/src/lib/libcrypto/bio/bss_mem.c | |||
| @@ -284,6 +284,7 @@ static int mem_gets(BIO *bp, char *buf, int size) | |||
| 284 | 284 | ||
| 285 | BIO_clear_retry_flags(bp); | 285 | BIO_clear_retry_flags(bp); |
| 286 | j=bm->length; | 286 | j=bm->length; |
| 287 | if ((size-1) < j) j=size-1; | ||
| 287 | if (j <= 0) | 288 | if (j <= 0) |
| 288 | { | 289 | { |
| 289 | *buf='\0'; | 290 | *buf='\0'; |
| @@ -292,17 +293,18 @@ static int mem_gets(BIO *bp, char *buf, int size) | |||
| 292 | p=bm->data; | 293 | p=bm->data; |
| 293 | for (i=0; i<j; i++) | 294 | for (i=0; i<j; i++) |
| 294 | { | 295 | { |
| 295 | if (p[i] == '\n') break; | 296 | if (p[i] == '\n') |
| 296 | } | 297 | { |
| 297 | if (i == j) | 298 | i++; |
| 298 | { | 299 | break; |
| 299 | BIO_set_retry_read(bp); | 300 | } |
| 300 | /* return(-1); change the semantics 0.6.6a */ | ||
| 301 | } | 301 | } |
| 302 | else | 302 | |
| 303 | i++; | 303 | /* |
| 304 | /* i is the max to copy */ | 304 | * i is now the max num of bytes to copy, either j or up to |
| 305 | if ((size-1) < i) i=size-1; | 305 | * and including the first newline |
| 306 | */ | ||
| 307 | |||
| 306 | i=mem_read(bp,buf,i); | 308 | i=mem_read(bp,buf,i); |
| 307 | if (i > 0) buf[i]='\0'; | 309 | if (i > 0) buf[i]='\0'; |
| 308 | ret=i; | 310 | ret=i; |
diff --git a/src/lib/libcrypto/bio/bss_sock.c b/src/lib/libcrypto/bio/bss_sock.c index 472dd75821..30c3ceab46 100644 --- a/src/lib/libcrypto/bio/bss_sock.c +++ b/src/lib/libcrypto/bio/bss_sock.c | |||
| @@ -60,6 +60,9 @@ | |||
| 60 | #include <errno.h> | 60 | #include <errno.h> |
| 61 | #define USE_SOCKETS | 61 | #define USE_SOCKETS |
| 62 | #include "cryptlib.h" | 62 | #include "cryptlib.h" |
| 63 | |||
| 64 | #ifndef OPENSSL_NO_SOCK | ||
| 65 | |||
| 63 | #include <openssl/bio.h> | 66 | #include <openssl/bio.h> |
| 64 | 67 | ||
| 65 | #ifdef WATT32 | 68 | #ifdef WATT32 |
| @@ -300,3 +303,5 @@ int BIO_sock_non_fatal_error(int err) | |||
| 300 | } | 303 | } |
| 301 | return(0); | 304 | return(0); |
| 302 | } | 305 | } |
| 306 | |||
| 307 | #endif /* #ifndef OPENSSL_NO_SOCK */ | ||
