]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Improve standard compliance for memset_s() and abort_handler_s().
authorKonstantin Belousov <kib@FreeBSD.org>
Sat, 12 Aug 2017 15:18:17 +0000 (15:18 +0000)
committerKonstantin Belousov <kib@FreeBSD.org>
Sat, 12 Aug 2017 15:18:17 +0000 (15:18 +0000)
commit25b73e6327d203d869442fd3991c9531b96d51ae
tree10347da31c183857e366382ea1eb05e7d2cd24bc
parent6fe9e5b8219a9504e6206be82a3175cbab4add50
Improve standard compliance for memset_s() and abort_handler_s().

abort_handler_s() currently simply calls abort(), though the standard
specifies more: "Writes an implementation-defined message to stderr
which must include the string pointed to by msg and calls abort()."

memset_s() is missing error condition "n > smax", and does not invoke
the constraint handler after filling the buffer: "following errors are
detected at runtime and call the currently installed constraint
handler function after storing ch in every location of the destination
range [dest, dest+destsz) if dest and destsz are themselves valid",
one of the errors is "n > smax" itself.

Submitted by: Yuri Pankov <yuripv@gmx.com>
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D11991
lib/libc/stdlib/set_constraint_handler_s.c
lib/libc/string/memset_s.c
lib/libc/tests/string/memset_s_test.c