Skip to content

Commit 570fa53

Browse files
committed
Release v03032018 3.3.0
See ChangeLog
1 parent 4c9318b commit 570fa53

File tree

4 files changed

+30
-27
lines changed

4 files changed

+30
-27
lines changed

ChangeLog

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
ChangeLog file for safeclib
33

4-
Changes in v??032018 3.3.0
4+
Changes in v03032018 3.3.0
55
- Added compile-time and run-time object_size checks (BOS), resulting
66
in EOVERFLOW error codes. Compilers only do this reliably with static
77
arrays, less so with literal strings. With known static allocation size
@@ -15,7 +15,7 @@ Changes in v??032018 3.3.0
1515
memcpy native, with gcc only 77% slower.
1616
Added more benchmarks and improved the timing.
1717
- Made the unsafe functions snprintf_s, vsnprintf_s, snwprintf_s, vsnwprintf_s
18-
safe by guaranteeing null termination. Only tmpnam_s remains unsafe.
18+
safe by guaranteeing null termination. Only tmpnam_s remains unsafe. (GH #52)
1919
- Added strnatcmp_s, strnatcasecmp_s
2020
- Add --disable-constraint-handler option. undef the run-time
2121
invoke_safe_{str,mem}_constraint_handler function calls
@@ -45,7 +45,7 @@ Changes in v??032018 3.3.0
4545
- More hardening with gcc-7.3/clang-7: Probe for -Wl,-z,textonly and
4646
-Wl,-z,retpolineplt, currently only with lld-7
4747
- Fixed wcsnorm_compose_s >RSIZE_MAX_WSTR integer overflow
48-
- Fixed overlap checks to be C11 conformant, cast to uintptr_t.
48+
- Fixed overlap checks to be C11 conformant, cast to uintptr_t. (GH #51)
4949
- add strnatcmp_s, add strcmp_s src overflow checks,
5050
ESUNTERM for src to avoid overflows
5151
- Reworked C11 compatibility to closer align with the existing Windows+BSD

Makefile.am

-1
Original file line numberDiff line numberDiff line change
@@ -620,4 +620,3 @@ release: docs distcheck
620620
git commit -m"Update to v`date +%d%m%Y`"
621621
git push
622622
git checkout master
623-
build-tools/autogen.sh

README

+17-12
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,8 @@ The TR24731 specification says an implementation may set errno for the
9393
functions defined in the technical report, but is not required to.
9494
This library does not set `errno` in most functions, only in
9595
bsearch_s, fscanf_s, fwscanf_s, gets_s, gmtime_s, localtime_s,
96-
scanf_s, sprintf_s, sscanf_s, swprintf_s, swscanf_s, strtok_s, vfscanf_s,
97-
vfwscanf_s, vsscanf_s vsprintf_s, vswprintf_s, vswscanf_s, wcstok_s,
98-
wscanf_s.
96+
scanf_s, sscanf_s, swscanf_s, strtok_s, vfscanf_s,
97+
vfwscanf_s, vsscanf_s, vswscanf_s, wcstok_s, wscanf_s.
9998

10099
In most cases the safeclib extended ES* errors do not set errno, only
101100
when the underlying insecure system call fails, errno is set. The
@@ -113,11 +112,14 @@ Per the spec, multiple runtime-constraint violations in the same call to a
113112
library function result in only one call to the runtime-constraint handler.
114113
The first violation encountered invokes the runtime-constraint handler.
115114

115+
With `--disable-constraint-handler` calling the runtime-constraint handler
116+
can be disabled, saving some memory, but not much run-time performance.
117+
116118
The runtime-constraint handler might not return. If the handler does
117119
return, the library function whose runtime-constraint was violated
118120
returns an indication of failure as given by the function’s return.
119121
With valid dest and dmax values, dest is cleared. With the optional
120-
--disable-null-slack only the first value of dest is cleared,
122+
`--disable-null-slack` only the first value of dest is cleared,
121123
otherwise the whole dest buffer.
122124

123125
rsize_t::
@@ -141,9 +143,9 @@ are performed at compile-time. Currently only since clang-5 with
141143
`diagnose_if` support. This checks similar to `_FORTIFY_SOURCE=2` if
142144
the `__builtin_object_size` of the dest buffer is the same size as
143145
dmax, and errors if dmax is too big. With the optional
144-
--enable-warn-dmax it prints a warning if the sizes are different,
146+
`--enable-warn-dmax` it prints a warning if the sizes are different,
145147
which is esp. practical as compile-time warning. It can be promoted
146-
via the optional --enable-error-dmax to be fatal. On unsupported
148+
via the optional `--enable-error-dmax` to be fatal. On unsupported
147149
compilers, the overflow check and optional equality warn-dmax check is
148150
deferred to run-time. This check is only possible with
149151
`__builtin_object_size` and `-O2` when the dest buffer size is known
@@ -152,11 +154,14 @@ at compile-time, otherwise only the simplier `dest == NULL`, `dmax ==
152154

153155
* Header Files
154156

155-
The specification states the various functions would be added to existing
156-
Standard C header files: stdio.h, string.h, etc. This implementation
157-
separates the memory related functions into the `safe_mem_lib.h` header, the
158-
string related functions into the `safe_str_lib.h` header, and the rest into
159-
the `safe_lib.h` header.
157+
The specification states the various functions would be added to
158+
existing Standard C header files: stdio.h, string.h, etc. This
159+
implementation separates the memory related functions into the
160+
`safe_mem_lib.h` header, the string related functions into the
161+
`safe_str_lib.h` header, and the rest into the `safe_lib.h`
162+
header. There are also the internal `safe_compile.h`, `safe_config.h`
163+
`safe_lib_errno.h` and `safe_types.h` headers, but they do not need to
164+
be included.
160165

161166
The make file builds a single library `libsafec-VERSION.a` and `.so` in the
162167
`src/.libs` directory.
@@ -256,7 +261,7 @@ with most available compilers. See `build-tools/smoke.sh`.
256261
Known Issues
257262
------------
258263
1. If you are building the library from the git repository you will have to
259-
first run build-tools/autogen.sh which runs autoreconf to ``install'' the
264+
first run `build-tools/autogen.sh` which runs autoreconf to ``install'' the
260265
autotools files and create the configure script.
261266

262267
[bibliography]

doc/libc-overview.md

+10-11
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ From the following tested libc implementations:
1010
* FreeBSD and DragonFly libc
1111
* FreeBSD-derived darwin libc
1212
* OpenBSD libc
13-
* newlib
13+
* newlib (Cygwin)
1414
* dietlibc
1515
* uClibc
1616
* minilibc
17-
* Microsoft Windows w/ secure API
17+
* Microsoft Windows under wine
18+
* Microsoft Windows msvcrt and ulibc w/ secure API
1819
* Android Bionic
1920
* Embarcadero C++ libc
2021

@@ -49,12 +50,9 @@ See also http://crashcourse.housegordon.org/coreutils-multibyte-support.html
4950

5051
# C11 Annex K/safec caveats
5152

52-
* `snprintf_s`, `vsnprintf_s`, `snwprintf_s`, `vsnwprintf_s`, `tmpnam_s`:
53+
* `tmpnam_s`:
5354

54-
They are all considered unsafe. The 4 'n' truncating printf versions
55-
don't guarantee null-delimited destination buffers.
56-
57-
* `tmpnam_s` and `tmpnam` are racy.
55+
Is considered unsafe. `tmpnam_s` and `tmpnam` are racy.
5856

5957
* `sprintf_s` and `vsprintf_s` retval on errors.
6058

@@ -90,14 +88,15 @@ See also http://crashcourse.housegordon.org/coreutils-multibyte-support.html
9088

9189
* no `RSIZE_MAX`
9290

93-
* `memmove_s` does not clear dest with ERANGE when count > dmax and EINVAL when
91+
* `memmove_s` does not clear dest with ERANGE when `count > dmax` and EINVAL when
9492
src is a NULL pointer.
9593

9694
* `vsprintf_s`, `sprintf_s` return `-1` on all errors, not just encoding errors.
9795
(Wrong standard)
9896

99-
* With `wcsrtombs` (used by `wcsrtomb_s`) the `*retval` result includes the terminating
100-
zero, i.e. the result is `+1` from the spec.
97+
* With `wcsrtombs` (used by `wcsrtomb_s`) the `*retval` result
98+
includes the terminating zero, i.e. the result is `+1` from the
99+
spec.
101100

102101
## safeclib
103102

@@ -194,4 +193,4 @@ compile-time known sizes the FORTIFY `_chk` extension secures against
194193
overflows, but not against dynamically allocated buffers. This library
195194
was written 2008 under the MIT license, thanks Cisco.
196195

197-
Reini Urban 2017
196+
Reini Urban 2018

0 commit comments

Comments
 (0)