diff options
Diffstat (limited to 'secure/lib/libcrypto/man/buffer.3')
-rw-r--r-- | secure/lib/libcrypto/man/buffer.3 | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/secure/lib/libcrypto/man/buffer.3 b/secure/lib/libcrypto/man/buffer.3 index 8cd00a8..726ac04 100644 --- a/secure/lib/libcrypto/man/buffer.3 +++ b/secure/lib/libcrypto/man/buffer.3 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.30) +.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== @@ -133,14 +133,17 @@ .\" ======================================================================== .\" .IX Title "buffer 3" -.TH buffer 3 "2015-07-09" "1.0.1p" "OpenSSL" +.TH buffer 3 "2015-12-03" "1.0.1q" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" -BUF_MEM_new, BUF_MEM_free, BUF_MEM_grow, BUF_strdup \- simple -character arrays structure +BUF_MEM_new, BUF_MEM_new_ex, BUF_MEM_free, BUF_MEM_grow \- simple +character array structure +.PP +BUF_strdup, BUF_strndup, BUF_memdup, BUF_strlcpy, BUF_strlcat \- +standard C library equivalents .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 @@ -152,28 +155,21 @@ character arrays structure \& \& int BUF_MEM_grow(BUF_MEM *str, int len); \& -\& char * BUF_strdup(const char *str); +\& char *BUF_strdup(const char *str); +\& +\& char *BUF_strndup(const char *str, size_t siz); +\& +\& void *BUF_memdup(const void *data, size_t siz); +\& +\& size_t BUF_strlcpy(char *dst, const char *src, size_t size); +\& +\& size_t BUF_strlcat(char *dst, const char *src, size_t size); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" The buffer library handles simple character arrays. Buffers are used for various purposes in the library, most notably memory BIOs. .PP -The library uses the \s-1BUF_MEM\s0 structure defined in buffer.h: -.PP -.Vb 6 -\& typedef struct buf_mem_st -\& { -\& int length; /* current number of bytes */ -\& char *data; -\& int max; /* size of buffer */ -\& } BUF_MEM; -.Ve -.PP -\&\fBlength\fR is the current size of the buffer in bytes, \fBmax\fR is the amount of -memory allocated to the buffer. There are three functions which handle these -and one \*(L"miscellaneous\*(R" function. -.PP \&\fIBUF_MEM_new()\fR allocates a new buffer of zero size. .PP \&\fIBUF_MEM_free()\fR frees up an already existing buffer. The data is zeroed @@ -183,14 +179,17 @@ before freeing up in case the buffer contains sensitive data. \&\fBlen\fR. Any data already in the buffer is preserved if it increases in size. .PP -\&\fIBUF_strdup()\fR copies a null terminated string into a block of allocated -memory and returns a pointer to the allocated block. -Unlike the standard C library \fIstrdup()\fR this function uses \fIOPENSSL_malloc()\fR and so -should be used in preference to the standard library \fIstrdup()\fR because it can -be used for memory leak checking or replacing the \fImalloc()\fR function. +\&\fIBUF_strdup()\fR, \fIBUF_strndup()\fR, \fIBUF_memdup()\fR, \fIBUF_strlcpy()\fR and +\&\fIBUF_strlcat()\fR are equivalents of the standard C library functions. The +\&\fIdup()\fR functions use \fIOPENSSL_malloc()\fR underneath and so should be used +in preference to the standard library for memory leak checking or +replacing the \fImalloc()\fR function. +.PP +Memory allocated from these functions should be freed up using the +\&\fIOPENSSL_free()\fR function. .PP -The memory allocated from \fIBUF_strdup()\fR should be freed up using the \fIOPENSSL_free()\fR -function. +BUF_strndup makes the explicit guarantee that it will never read past +the first \fBsiz\fR bytes of \fBstr\fR. .SH "RETURN VALUES" .IX Header "RETURN VALUES" \&\fIBUF_MEM_new()\fR returns the buffer or \s-1NULL\s0 on error. |