| Description: | String functions that abort(3) when getting out of bounds |
| Status: | Complete |
| Source: | https://git.maandree.se/libabort |
| Latest release: | 1.0 |
| License: | ISC License (Internet Systems Consortium license) |
| Written in: | C (ISO C99) |
libabort provides properly safe alternatives to string functions in the standard C libraries. When working with strings, the correct thing to do is to allocate an sufficiently large buffer, and than use the so-called unsafe functions, but a poperly unsafe alternative that is touted as safe, is to the incorrect (as technically defined) (but robust) thing and use functions that truncate when getting out of bounds. libabort provides an alternative similar to doing both: it expects that you provide a sufficiently large buffer, than you use libabort's bounds checking implementations, that look similar to the truncating functions, but instead terminate the process by calling abort(3) if the buffer is too small, ensuring truncation cannot lead to unsafe behaviour and letting you know that your code is buggy.