1863edaecSDag-Erling Smørgrav.\"- 2863edaecSDag-Erling Smørgrav.\" Copyright (c) 2000 Poul Henning Kamp and Dag-Erling Co�dan Sm�rgrav 3863edaecSDag-Erling Smørgrav.\" All rights reserved. 4863edaecSDag-Erling Smørgrav.\" 5863edaecSDag-Erling Smørgrav.\" Redistribution and use in source and binary forms, with or without 6863edaecSDag-Erling Smørgrav.\" modification, are permitted provided that the following conditions 7863edaecSDag-Erling Smørgrav.\" are met: 8863edaecSDag-Erling Smørgrav.\" 1. Redistributions of source code must retain the above copyright 9863edaecSDag-Erling Smørgrav.\" notice, this list of conditions and the following disclaimer. 10863edaecSDag-Erling Smørgrav.\" 2. Redistributions in binary form must reproduce the above copyright 11863edaecSDag-Erling Smørgrav.\" notice, this list of conditions and the following disclaimer in the 12863edaecSDag-Erling Smørgrav.\" documentation and/or other materials provided with the distribution. 13863edaecSDag-Erling Smørgrav.\" 14863edaecSDag-Erling Smørgrav.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15863edaecSDag-Erling Smørgrav.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16863edaecSDag-Erling Smørgrav.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17863edaecSDag-Erling Smørgrav.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18863edaecSDag-Erling Smørgrav.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19863edaecSDag-Erling Smørgrav.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20863edaecSDag-Erling Smørgrav.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21863edaecSDag-Erling Smørgrav.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22863edaecSDag-Erling Smørgrav.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23863edaecSDag-Erling Smørgrav.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24863edaecSDag-Erling Smørgrav.\" SUCH DAMAGE. 25863edaecSDag-Erling Smørgrav.\" 26863edaecSDag-Erling Smørgrav.\" $FreeBSD$ 27863edaecSDag-Erling Smørgrav.\" 28371c0c84SKelly Yancey.Dd January 3, 2002 295f95f24bSRuslan Ermilov.Dt SBUF 9 303d45e180SRuslan Ermilov.Os 31863edaecSDag-Erling Smørgrav.Sh NAME 32863edaecSDag-Erling Smørgrav.Nm sbuf_new , 33e499b74dSDag-Erling Smørgrav.Nm sbuf_clear , 34863edaecSDag-Erling Smørgrav.Nm sbuf_setpos , 35b0def2b5SDag-Erling Smørgrav.Nm sbuf_bcat , 36b0def2b5SDag-Erling Smørgrav.Nm sbuf_bcopyin , 37b0def2b5SDag-Erling Smørgrav.Nm sbuf_bcpy , 38863edaecSDag-Erling Smørgrav.Nm sbuf_cat , 39b0def2b5SDag-Erling Smørgrav.Nm sbuf_copyin , 40863edaecSDag-Erling Smørgrav.Nm sbuf_cpy , 41863edaecSDag-Erling Smørgrav.Nm sbuf_printf , 42371c0c84SKelly Yancey.Nm sbuf_vprintf , 43863edaecSDag-Erling Smørgrav.Nm sbuf_putc , 44371c0c84SKelly Yancey.Nm sbuf_trim , 45e499b74dSDag-Erling Smørgrav.Nm sbuf_overflowed , 46863edaecSDag-Erling Smørgrav.Nm sbuf_finish , 47863edaecSDag-Erling Smørgrav.Nm sbuf_data , 48863edaecSDag-Erling Smørgrav.Nm sbuf_len , 49c5f9218bSPoul-Henning Kamp.Nm sbuf_done , 50863edaecSDag-Erling Smørgrav.Nm sbuf_delete 51863edaecSDag-Erling Smørgrav.Nd safe string formatting 52863edaecSDag-Erling Smørgrav.Sh SYNOPSIS 5332eef9aeSRuslan Ermilov.In sys/types.h 5432eef9aeSRuslan Ermilov.In sys/sbuf.h 558a5bc771SBruce Evans.Ft struct sbuf * 56e499b74dSDag-Erling Smørgrav.Fn sbuf_new "struct sbuf *s" "char *buf" "int length" "int flags" 57e499b74dSDag-Erling Smørgrav.Ft void 58e499b74dSDag-Erling Smørgrav.Fn sbuf_clear "struct sbuf *s" 59863edaecSDag-Erling Smørgrav.Ft int 60e499b74dSDag-Erling Smørgrav.Fn sbuf_setpos "struct sbuf *s" "int pos" 61863edaecSDag-Erling Smørgrav.Ft int 62b0def2b5SDag-Erling Smørgrav.Fn sbuf_bcat "struct sbuf *s" "const char *str" "size_t len" 63b0def2b5SDag-Erling Smørgrav.Ft int 64b0def2b5SDag-Erling Smørgrav.Fn sbuf_bcopyin "struct sbuf *s" "const void *uaddr" "size_t len" 65b0def2b5SDag-Erling Smørgrav.Ft int 66b0def2b5SDag-Erling Smørgrav.Fn sbuf_bcpy "struct sbuf *s" "const char *str" "size_t len" 67b0def2b5SDag-Erling Smørgrav.Ft int 683393f8daSKenneth D. Merry.Fn sbuf_cat "struct sbuf *s" "const char *str" 69863edaecSDag-Erling Smørgrav.Ft int 70b0def2b5SDag-Erling Smørgrav.Fn sbuf_copyin "struct sbuf *s" "const void *uaddr" "size_t len" 71b0def2b5SDag-Erling Smørgrav.Ft int 723393f8daSKenneth D. Merry.Fn sbuf_cpy "struct sbuf *s" "const char *str" 73863edaecSDag-Erling Smørgrav.Ft int 748cce2ebaSDag-Erling Smørgrav.Fn sbuf_printf "struct sbuf *s" "const char *fmt" "..." 75863edaecSDag-Erling Smørgrav.Ft int 76371c0c84SKelly Yancey.Fn sbuf_vprintf "struct sbuf *s" "const char *fmt" "va_list ap" 77371c0c84SKelly Yancey.Ft int 78863edaecSDag-Erling Smørgrav.Fn sbuf_putc "struct sbuf *s" "int c" 79863edaecSDag-Erling Smørgrav.Ft int 80371c0c84SKelly Yancey.Fn sbuf_trim "struct sbuf *s" 81371c0c84SKelly Yancey.Ft int 82e499b74dSDag-Erling Smørgrav.Fn sbuf_overflowed "struct sbuf *s" 83e499b74dSDag-Erling Smørgrav.Ft void 84863edaecSDag-Erling Smørgrav.Fn sbuf_finish "struct sbuf *s" 85863edaecSDag-Erling Smørgrav.Ft char * 86863edaecSDag-Erling Smørgrav.Fn sbuf_data "struct sbuf *s" 87e499b74dSDag-Erling Smørgrav.Ft int 88863edaecSDag-Erling Smørgrav.Fn sbuf_len "struct sbuf *s" 89c5f9218bSPoul-Henning Kamp.Ft int 90c5f9218bSPoul-Henning Kamp.Fn sbuf_done "struct sbuf *s" 91863edaecSDag-Erling Smørgrav.Ft void 92863edaecSDag-Erling Smørgrav.Fn sbuf_delete "struct sbuf *s" 93863edaecSDag-Erling Smørgrav.Sh DESCRIPTION 94863edaecSDag-Erling SmørgravThe 95863edaecSDag-Erling Smørgrav.Nm sbuf 9667e35919SSheldon Hearnfamily of functions allows one to safely allocate, construct and 97863edaecSDag-Erling Smørgravrelease bounded null-terminated strings in kernel space. 98863edaecSDag-Erling SmørgravInstead of arrays of characters, these functions operate on structures 99863edaecSDag-Erling Smørgravcalled 100863edaecSDag-Erling Smørgrav.Fa sbufs , 101863edaecSDag-Erling Smørgravdefined in 102fe08efe6SRuslan Ermilov.In sys/sbuf.h . 103863edaecSDag-Erling Smørgrav.Pp 104863edaecSDag-Erling SmørgravThe 105863edaecSDag-Erling Smørgrav.Fn sbuf_new 106863edaecSDag-Erling Smørgravfunction initializes the 107863edaecSDag-Erling Smørgrav.Fa sbuf 108863edaecSDag-Erling Smørgravpointed to by its first argument. 109d6479358SDag-Erling SmørgravIf that pointer is 110d6479358SDag-Erling Smørgrav.Dv NULL , 111d6479358SDag-Erling Smørgrav.Fn sbuf_new 112d6479358SDag-Erling Smørgravallocates a 113d68b700aSRuslan Ermilov.Vt struct sbuf 114d6479358SDag-Erling Smørgravusing 115d6479358SDag-Erling Smørgrav.Xr malloc 9 . 116863edaecSDag-Erling SmørgravThe 117863edaecSDag-Erling Smørgrav.Fa buf 118863edaecSDag-Erling Smørgravargument is a pointer to a buffer in which to store the actual string; 119863edaecSDag-Erling Smørgravif it is 120863edaecSDag-Erling Smørgrav.Dv NULL , 121863edaecSDag-Erling Smørgrav.Fn sbuf_new 122863edaecSDag-Erling Smørgravwill allocate one using 123863edaecSDag-Erling Smørgrav.Xr malloc 9 . 124863edaecSDag-Erling SmørgravThe 125863edaecSDag-Erling Smørgrav.Fa length 126371c0c84SKelly Yanceyis the initial size of the storage buffer. 127863edaecSDag-Erling SmørgravThe fourth argument, 128863edaecSDag-Erling Smørgrav.Fa flags , 129371c0c84SKelly Yanceymay be comprised of the following flags: 1303b0536faSRuslan Ermilov.Bl -tag -width ".Dv SBUF_AUTOEXTEND" 131371c0c84SKelly Yancey.It Dv SBUF_FIXEDLEN 1323b0536faSRuslan ErmilovThe storage buffer is fixed at its initial size. 133371c0c84SKelly YanceyAttempting to extend the sbuf beyond this size results in an overflow condition. 134371c0c84SKelly Yancey.It Dv SBUF_AUTOEXTEND 135371c0c84SKelly YanceyThis indicates that the storage buffer may be extended as necessary, so long 136371c0c84SKelly Yanceyas resources allow, to hold additional data. 137371c0c84SKelly Yancey.El 138863edaecSDag-Erling Smørgrav.Pp 139863edaecSDag-Erling SmørgravNote that if 140863edaecSDag-Erling Smørgrav.Fa buf 141863edaecSDag-Erling Smørgravis not 142863edaecSDag-Erling Smørgrav.Dv NULL , 143863edaecSDag-Erling Smørgravit must point to an array of at least 144863edaecSDag-Erling Smørgrav.Fa length 145863edaecSDag-Erling Smørgravcharacters. 14691c9d24eSDag-Erling SmørgravThe result of accessing that array directly while it is in use by the 14791c9d24eSDag-Erling Smørgravsbuf is undefined. 14891c9d24eSDag-Erling Smørgrav.Pp 14991c9d24eSDag-Erling SmørgravThe 15091c9d24eSDag-Erling Smørgrav.Fn sbuf_delete 15191c9d24eSDag-Erling Smørgravfunction clears the 15291c9d24eSDag-Erling Smørgrav.Fa sbuf 15391c9d24eSDag-Erling Smørgravand frees any memory allocated for it. 15491c9d24eSDag-Erling SmørgravThere must be a call to 15591c9d24eSDag-Erling Smørgrav.Fn sbuf_delete 15691c9d24eSDag-Erling Smørgravfor every call to 15791c9d24eSDag-Erling Smørgrav.Fn sbuf_new . 15891c9d24eSDag-Erling SmørgravAny attempt to access the sbuf after it has been deleted will fail. 159863edaecSDag-Erling Smørgrav.Pp 160863edaecSDag-Erling SmørgravThe 161e499b74dSDag-Erling Smørgrav.Fn sbuf_clear 162e499b74dSDag-Erling Smørgravfunction invalidates the contents of the 163e499b74dSDag-Erling Smørgrav.Fa sbuf 164e499b74dSDag-Erling Smørgravand resets its position to zero. 165e499b74dSDag-Erling Smørgrav.Pp 166e499b74dSDag-Erling SmørgravThe 167863edaecSDag-Erling Smørgrav.Fn sbuf_setpos 168863edaecSDag-Erling Smørgravfunction sets the 169863edaecSDag-Erling Smørgrav.Fa sbuf Ns 's 170371c0c84SKelly Yanceyend position to 171863edaecSDag-Erling Smørgrav.Fa pos , 172863edaecSDag-Erling Smørgravwhich is a value between zero and one less than the size of the 173863edaecSDag-Erling Smørgravstorage buffer. 174371c0c84SKelly YanceyThis effectively truncates the sbuf at the new position. 175863edaecSDag-Erling Smørgrav.Pp 176863edaecSDag-Erling SmørgravThe 177b0def2b5SDag-Erling Smørgrav.Fn sbuf_bcat 178b0def2b5SDag-Erling Smørgravfunction appends the first 179b0def2b5SDag-Erling Smørgrav.Fa len 180b0def2b5SDag-Erling Smørgravbytes from the byte string 181b0def2b5SDag-Erling Smørgrav.Fa str 182b0def2b5SDag-Erling Smørgravto the 183b0def2b5SDag-Erling Smørgrav.Fa sbuf . 184b0def2b5SDag-Erling Smørgrav.Pp 185b0def2b5SDag-Erling SmørgravThe 186b0def2b5SDag-Erling Smørgrav.Fn sbuf_bcopyin 187b0def2b5SDag-Erling Smørgravfunction copies 188b0def2b5SDag-Erling Smørgrav.Fa len 189b0def2b5SDag-Erling Smørgravbytes from the specified userland address into the 190b0def2b5SDag-Erling Smørgrav.Fa sbuf . 191b0def2b5SDag-Erling Smørgrav.Pp 192b0def2b5SDag-Erling SmørgravThe 193b0def2b5SDag-Erling Smørgrav.Fn sbuf_bcpy 194b0def2b5SDag-Erling Smørgravfunction replaces the contents of the 195b0def2b5SDag-Erling Smørgrav.Fa sbuf 196b0def2b5SDag-Erling Smørgravwith the first 197b0def2b5SDag-Erling Smørgrav.Fa len 198b0def2b5SDag-Erling Smørgravbytes from the byte string 199b0def2b5SDag-Erling Smørgrav.Fa str . 200b0def2b5SDag-Erling Smørgrav.Pp 201b0def2b5SDag-Erling SmørgravThe 202863edaecSDag-Erling Smørgrav.Fn sbuf_cat 203b0def2b5SDag-Erling Smørgravfunction appends the NUL-terminated string 204863edaecSDag-Erling Smørgrav.Fa str 205863edaecSDag-Erling Smørgravto the 206863edaecSDag-Erling Smørgrav.Fa sbuf 207863edaecSDag-Erling Smørgravat the current position. 208863edaecSDag-Erling Smørgrav.Pp 209863edaecSDag-Erling SmørgravThe 210b0def2b5SDag-Erling Smørgrav.Fn sbuf_copyin 211b0def2b5SDag-Erling Smørgravfunction copies a NUL-terminated string from the specified userland 212b0def2b5SDag-Erling Smørgravaddress into the 213b0def2b5SDag-Erling Smørgrav.Fa sbuf . 214b0def2b5SDag-Erling SmørgravIf the 215b0def2b5SDag-Erling Smørgrav.Fa len 216b0def2b5SDag-Erling Smørgravargument is non-zero, no more than 217b0def2b5SDag-Erling Smørgrav.Fa len 218b0def2b5SDag-Erling Smørgravcharacters (not counting the terminating NUL) are copied; otherwise 219b0def2b5SDag-Erling Smørgravthe entire string, or as much of it as can fit in the 220b0def2b5SDag-Erling Smørgrav.Fa sbuf , 221b0def2b5SDag-Erling Smørgravis copied. 222b0def2b5SDag-Erling Smørgrav.Pp 223b0def2b5SDag-Erling SmørgravThe 224863edaecSDag-Erling Smørgrav.Fn sbuf_cpy 225863edaecSDag-Erling Smørgravfunction replaces the contents of the 226863edaecSDag-Erling Smørgrav.Fa sbuf 227b0def2b5SDag-Erling Smørgravwith those of the NUL-terminated string 228863edaecSDag-Erling Smørgrav.Fa str . 229863edaecSDag-Erling SmørgravThis is equivalent to calling 230863edaecSDag-Erling Smørgrav.Fn sbuf_cat 231863edaecSDag-Erling Smørgravwith a fresh 232863edaecSDag-Erling Smørgrav.Fa sbuf 233863edaecSDag-Erling Smørgravor one which position has been reset to zero with 234e499b74dSDag-Erling Smørgrav.Fn sbuf_clear 235e499b74dSDag-Erling Smørgravor 236863edaecSDag-Erling Smørgrav.Fn sbuf_setpos . 237863edaecSDag-Erling Smørgrav.Pp 238863edaecSDag-Erling SmørgravThe 239863edaecSDag-Erling Smørgrav.Fn sbuf_printf 240863edaecSDag-Erling Smørgravfunction formats its arguments according to the format string pointed 241863edaecSDag-Erling Smørgravto by 242863edaecSDag-Erling Smørgrav.Fa fmt 243863edaecSDag-Erling Smørgravand appends the resulting string to the 244863edaecSDag-Erling Smørgrav.Fa sbuf 245863edaecSDag-Erling Smørgravat the current position. 246863edaecSDag-Erling Smørgrav.Pp 247863edaecSDag-Erling SmørgravThe 248371c0c84SKelly Yancey.Fn sbuf_vprintf 249371c0c84SKelly Yanceyfunction behaves the same as 250371c0c84SKelly Yancey.Fn sbuf_printf 251371c0c84SKelly Yanceyexcept that the arguments are obtained from the variable-length argument list 252371c0c84SKelly Yancey.Fa ap . 253371c0c84SKelly Yancey.Pp 254371c0c84SKelly YanceyThe 255863edaecSDag-Erling Smørgrav.Fn sbuf_putc 256863edaecSDag-Erling Smørgravfunction appends the character 257863edaecSDag-Erling Smørgrav.Fa c 258863edaecSDag-Erling Smørgravto the 259863edaecSDag-Erling Smørgrav.Fa sbuf 260863edaecSDag-Erling Smørgravat the current position. 261863edaecSDag-Erling Smørgrav.Pp 262863edaecSDag-Erling SmørgravThe 263371c0c84SKelly Yancey.Fn sbuf_trim 264371c0c84SKelly Yanceyfunction removes trailing whitespace from the 265371c0c84SKelly Yancey.Fa sbuf . 266371c0c84SKelly Yancey.Pp 267371c0c84SKelly YanceyThe 268e499b74dSDag-Erling Smørgrav.Fn sbuf_overflowed 269e499b74dSDag-Erling Smørgravfunction returns a non-zero value if the 270e499b74dSDag-Erling Smørgrav.Fa sbuf 271e499b74dSDag-Erling Smørgravoverflowed. 272e499b74dSDag-Erling Smørgrav.Pp 273e499b74dSDag-Erling SmørgravThe 274863edaecSDag-Erling Smørgrav.Fn sbuf_finish 275863edaecSDag-Erling Smørgravfunction null-terminates the 276863edaecSDag-Erling Smørgrav.Fa sbuf 277863edaecSDag-Erling Smørgravand marks it as finished, which means that it may no longer be 278863edaecSDag-Erling Smørgravmodified using 279863edaecSDag-Erling Smørgrav.Fn sbuf_setpos , 280863edaecSDag-Erling Smørgrav.Fn sbuf_cat , 2813393f8daSKenneth D. Merry.Fn sbuf_cpy , 282863edaecSDag-Erling Smørgrav.Fn sbuf_printf 283863edaecSDag-Erling Smørgravor 284863edaecSDag-Erling Smørgrav.Fn sbuf_putc . 285863edaecSDag-Erling Smørgrav.Pp 286863edaecSDag-Erling SmørgravThe 287863edaecSDag-Erling Smørgrav.Fn sbuf_data 288863edaecSDag-Erling Smørgravand 289863edaecSDag-Erling Smørgrav.Fn sbuf_len 290e499b74dSDag-Erling Smørgravfunctions return the actual string and its length, respectively; 291e499b74dSDag-Erling Smørgrav.Fn sbuf_data 292e499b74dSDag-Erling Smørgravonly works on a finished 293863edaecSDag-Erling Smørgrav.Fa sbuf . 294c5f9218bSPoul-Henning Kamp.Fn sbuf_done 295c5f9218bSPoul-Henning Kampreturns non-zero if the sbuf is finished. 296863edaecSDag-Erling Smørgrav.Sh NOTES 297863edaecSDag-Erling SmørgravIf an operation caused an 298863edaecSDag-Erling Smørgrav.Fa sbuf 299e499b74dSDag-Erling Smørgravto overflow, most subsequent operations on it will fail until the 300e499b74dSDag-Erling Smørgrav.Fa sbuf 301e499b74dSDag-Erling Smørgravis finished using 302e499b74dSDag-Erling Smørgrav.Fn sbuf_finish 303e499b74dSDag-Erling Smørgravor reset using 304e499b74dSDag-Erling Smørgrav.Fn sbuf_clear , 305e499b74dSDag-Erling Smørgravor its position is reset to a value between 0 and one less than the 306e499b74dSDag-Erling Smørgravsize of its storage buffer using 307863edaecSDag-Erling Smørgrav.Fn sbuf_setpos , 308863edaecSDag-Erling Smørgravor it is reinitialized to a sufficiently short string using 309863edaecSDag-Erling Smørgrav.Fn sbuf_cpy . 310863edaecSDag-Erling Smørgrav.Sh RETURN VALUES 311863edaecSDag-Erling Smørgrav.Fn sbuf_new 312d6479358SDag-Erling Smørgravreturns 313d6479358SDag-Erling Smørgrav.Dv NULL 314d6479358SDag-Erling Smørgravif it failed to allocate a storage buffer, and a pointer to the new 315d6479358SDag-Erling Smørgrav.Fa sbuf 316863edaecSDag-Erling Smørgravotherwise. 317863edaecSDag-Erling Smørgrav.Pp 318863edaecSDag-Erling Smørgrav.Fn sbuf_setpos 319863edaecSDag-Erling Smørgravreturns \-1 if 320863edaecSDag-Erling Smørgrav.Fa pos 321863edaecSDag-Erling Smørgravwas invalid, and zero otherwise. 322863edaecSDag-Erling Smørgrav.Pp 323863edaecSDag-Erling Smørgrav.Fn sbuf_cat , 324863edaecSDag-Erling Smørgrav.Fn sbuf_cpy , 325863edaecSDag-Erling Smørgrav.Fn sbuf_printf , 326371c0c84SKelly Yancey.Fn sbuf_putc , 327863edaecSDag-Erling Smørgravand 328371c0c84SKelly Yancey.Fn sbuf_trim 329863edaecSDag-Erling Smørgravall return \-1 if the buffer overflowed, and zero otherwise. 330863edaecSDag-Erling Smørgrav.Pp 331e499b74dSDag-Erling Smørgrav.Fn sbuf_overflowed 332e499b74dSDag-Erling Smørgravreturns a non-zero value if the buffer overflowed, and zero otherwise. 333e499b74dSDag-Erling Smørgrav.Pp 334863edaecSDag-Erling Smørgrav.Fn sbuf_data 335863edaecSDag-Erling Smørgravand 336863edaecSDag-Erling Smørgrav.Fn sbuf_len 337863edaecSDag-Erling Smørgravreturn 338863edaecSDag-Erling Smørgrav.Dv NULL 339e499b74dSDag-Erling Smørgravand \-1, respectively, if the buffer overflowed. 340863edaecSDag-Erling Smørgrav.Sh SEE ALSO 341863edaecSDag-Erling Smørgrav.Xr printf 3 , 342863edaecSDag-Erling Smørgrav.Xr strcat 3 , 343d68b700aSRuslan Ermilov.Xr strcpy 3 , 344d68b700aSRuslan Ermilov.Xr copyin 9 , 345e05f3134SAndrew R. Reiter.Xr copyinstr 9 , 346e05f3134SAndrew R. Reiter.Xr printf 9 347863edaecSDag-Erling Smørgrav.Sh HISTORY 348863edaecSDag-Erling SmørgravThe 349863edaecSDag-Erling Smørgrav.Nm sbuf 350863edaecSDag-Erling Smørgravfamily of functions first appeared in 35122cbe5e3SDag-Erling Smørgrav.Fx 4.4 . 352863edaecSDag-Erling Smørgrav.Sh AUTHORS 353863edaecSDag-Erling Smørgrav.An -nosplit 354863edaecSDag-Erling SmørgravThe 355863edaecSDag-Erling Smørgrav.Nm sbuf 356863edaecSDag-Erling Smørgravfamily of functions was designed by 357863edaecSDag-Erling Smørgrav.An Poul-Henning Kamp Aq phk@FreeBSD.org 358863edaecSDag-Erling Smørgravand implemented by 359863edaecSDag-Erling Smørgrav.An Dag-Erling Co\(:idan Sm\(/orgrav Aq des@FreeBSD.org . 360e499b74dSDag-Erling SmørgravAdditional improvements were suggested by 361e499b74dSDag-Erling Smørgrav.An Justin T. Gibbs Aq gibbs@FreeBSD.org . 362371c0c84SKelly YanceyAuto-extend support added by 363371c0c84SKelly Yancey.An Kelly Yancey Aq kbyanc@FreeBSD.org . 364863edaecSDag-Erling Smørgrav.Pp 365863edaecSDag-Erling SmørgravThis manual page was written by 366863edaecSDag-Erling Smørgrav.An Dag-Erling Co\(:idan Sm\(/orgrav . 367