ssp: add Object Size Checking for stdlib.h
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
This commit is contained in:
parent
0fd2c9bd12
commit
1e43e181c2
30
newlib/libc/include/ssp/stdlib.h
Normal file
30
newlib/libc/include/ssp/stdlib.h
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#ifndef _SSP_STDLIB_H_
|
||||||
|
#define _SSP_STDLIB_H_
|
||||||
|
|
||||||
|
#include <ssp/ssp.h>
|
||||||
|
|
||||||
|
#if __SSP_FORTIFY_LEVEL > 0
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
__ssp_decl(size_t, mbstowcs, (wchar_t *__buf, const char *__src, size_t __n))
|
||||||
|
{
|
||||||
|
if (__buf != NULL)
|
||||||
|
__ssp_check(__buf, __n * sizeof(wchar_t), __ssp_bos);
|
||||||
|
return __ssp_real_mbstowcs (__buf, __src, __n);
|
||||||
|
}
|
||||||
|
|
||||||
|
__ssp_redirect_raw(size_t, wcstombs, \
|
||||||
|
(char *__buf, const wchar_t *__src, size_t __len), \
|
||||||
|
(__buf, __src, __len), __buf != NULL, __ssp_bos);
|
||||||
|
|
||||||
|
__ssp_decl(int, wctomb, (char *__buf, wchar_t __wc))
|
||||||
|
{
|
||||||
|
if (__buf != NULL)
|
||||||
|
__ssp_check(__buf, MB_CUR_MAX, __ssp_bos);
|
||||||
|
return __ssp_real_wctomb (__buf, __wc);
|
||||||
|
}
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif /* __SSP_FORTIFY_LEVEL > 0 */
|
||||||
|
#endif /* _SSP_STDLIB_H_ */
|
@ -334,4 +334,8 @@ _Noreturn void
|
|||||||
|
|
||||||
_END_STD_C
|
_END_STD_C
|
||||||
|
|
||||||
|
#if __SSP_FORTIFY_LEVEL > 0
|
||||||
|
#include <ssp/stdlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* _STDLIB_H_ */
|
#endif /* _STDLIB_H_ */
|
||||||
|
@ -39,6 +39,10 @@ fgets fread_unlocked sprintf
|
|||||||
fgets_unlocked gets vsnprintf
|
fgets_unlocked gets vsnprintf
|
||||||
fread snprintf vsprintf
|
fread snprintf vsprintf
|
||||||
|
|
||||||
|
@exdent @emph{Stdlib functions:}
|
||||||
|
mbstowcs wcstombs wctomb
|
||||||
|
|
||||||
@exdent @emph{System functions:}
|
@exdent @emph{System functions:}
|
||||||
getcwd read readlink
|
getcwd read readlink
|
||||||
|
|
||||||
@end example
|
@end example
|
||||||
|
Loading…
x
Reference in New Issue
Block a user