Index: lib/libc/string/Makefile.inc =================================================================== --- lib/libc/string/Makefile.inc +++ lib/libc/string/Makefile.inc @@ -50,6 +50,7 @@ ffs.3 flsll.3 MLINKS+=index.3 rindex.3 MLINKS+=memchr.3 memrchr.3 +MLINKS+=memset.3 memset_s.3 MLINKS+=strcasecmp.3 strncasecmp.3 \ strcasecmp.3 strcasecmp_l.3 \ strcasecmp.3 strncasecmp_l.3 Index: lib/libc/string/memset.3 =================================================================== --- lib/libc/string/memset.3 +++ lib/libc/string/memset.3 @@ -44,6 +44,7 @@ .In string.h .Ft void * .Fn memset "void *b" "int c" "size_t len" +.Fn memset_s "void *b" "rsize_t destsz" "int c" "rsize_t len" .Sh DESCRIPTION The .Fn memset @@ -56,6 +57,21 @@ .Vt "unsigned char" ) to the string .Fa b . +The +.Fn memset_s +function performs the same as +.Fn memset +except that an error is thrown and constraint handler is called if +.Fa b +is a null pointer, +.Fa destsz +or +.Fa len +is greater than RSIZE_MAX, or +.Fa len +is greater than +.Fa destsz +(buffer overflow would occur). .Sh RETURN VALUES The .Fn memset