---
name: "ssp"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/ssp"
---

# ssp(3)

bounds checked libc functions

## NAME

**ssp** – bounds checked libc functions

## LIBRARY

library “libssp”

## SYNOPSIS

**#include \<ssp/stdio.h\>**

*int*\

**sprintf**(*char \*str*, *const char \*fmt*, *...*);

*int*\

**vsprintf**(*char \*str*, *const char \*fmt*, *va\_list ap*);

*int*\

**snprintf**(*char \*str*, *size\_t len*, *const char \*fmt*, *...*);

*int*\

**vsnprintf**(*char \*str*, *size\_t len*, *const char \*fmt*, *va\_list ap*);

*char* *\**\

**fgets**(*char \*str*, *int len*, *FILE \*fp*);

**#include \<ssp/string.h\>**

*void* *\**\

**memcpy**(*void \*str*, *const void \*ptr*, *size\_t len*);

*void* *\**\

**memmove**(*void \*str*, *const void \*ptr*, *size\_t len*);

*void* *\**\

**memset**(*void \*str*, *int val*, *size\_t len*);

*char* *\**\

**stpcpy**(*char \*str*, *const char \*ptr*);

*char* *\**\

**strcpy**(*char \*str*, *const char \*ptr*);

*char* *\**\

**strcat**(*char \*str*, *const char \*ptr*);

*char* *\**\

**strncpy**(*char \*str*, *const char \*ptr*, *size\_t len*);

*char* *\**\

**strncat**(*char \*str*, *const char \*ptr*, *size\_t len*);

**#include \<ssp/strings.h\>**

*void* *\**\

**bcopy**(*const void \*ptr*, *void \*str*, *size\_t len*);

*void* *\**\

**bzero**(*void \*str*, *size\_t len*);

**#include \<ssp/unistd.h\>**

*ssize\_t*\

**read**(*int fd*, *void \*str*, *size\_t len*);

*int*\

**readlink**(*const char \* restrict path*, *char \* restrict str*, *size\_t len*);

*int*\

**getcwd**(*char \*str*, *size\_t len*);

## DESCRIPTION

When \_FORTIFY\_SOURCE bounds checking is enabled as described below, the above functions get overwritten to use the [\_\_builtin\_object\_size(3)](/__builtin_object_size/3.md) function to compute the size of *str*, if known at compile time, and perform bounds check on it in order to avoid data buffer or stack buffer overflows. If an overflow is detected, the routines will call [abort(3)](/abort/3.md).

To enable these function overrides the following should be added to the [clang(1)](/clang/1.md) or [gcc(1)](/gcc/1.md) command line: “-D\_FORTIFY\_SOURCE=1” or “-D\_FORTIFY\_SOURCE=2”.

If \_FORTIFY\_SOURCE is set to 1 the code will compute the maximum possible buffer size for *str*, and if set to 2 it will compute the minimum buffer size.

## SEE ALSO

[clang(1)](/clang/1.md), [gcc(1)](/gcc/1.md), [\_\_builtin\_object\_size(3)](/__builtin_object_size/3.md), [stdio(3)](/stdio/3.md), [string(3)](/string/3.md), [security(7)](/security/7.md)

## HISTORY

The **ssp** library appeared in NetBSD 4.0. This version of the **ssp** library replaced the GNU library of the same name in FreeBSD 12.2.
