From c19bb129a9bf66013f65d729c6c5913c225f09dd Mon Sep 17 00:00:00 2001 From: Ned Ludd Date: Tue, 8 Feb 2005 19:28:46 +0000 Subject: - 1/NN patches for ssp --- libc/sysdeps/linux/common/ssp.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'libc/sysdeps/linux/common/ssp.c') diff --git a/libc/sysdeps/linux/common/ssp.c b/libc/sysdeps/linux/common/ssp.c index 72d8dea2e..a3470ecdc 100644 --- a/libc/sysdeps/linux/common/ssp.c +++ b/libc/sysdeps/linux/common/ssp.c @@ -55,6 +55,9 @@ void __guard_setup(void) if (__guard != 0UL) return; + /* Start with the "terminator canary". */ + __guard = 0xFF0A0D00UL; + #ifndef __SSP_QUICK_CANARY__ #ifdef HAVE_DEV_ERANDOM /* Random is another depth in Linux, hence an array of 3. */ @@ -75,19 +78,17 @@ void __guard_setup(void) int fd; #ifdef HAVE_DEV_ERANDOM - if ((fd = open("/dev/erandom", O_RDONLY)) == (-1)) + if ((fd = __libc_open("/dev/erandom", O_RDONLY)) == (-1)) #endif - fd = open("/dev/urandom", O_RDONLY); + fd = __libc_open("/dev/urandom", O_RDONLY); if (fd != (-1)) { - size = read(fd, (char *) &__guard, sizeof(__guard)); - close(fd); + size = __libc_read(fd, (char *) &__guard, sizeof(__guard)); + __libc_close(fd); if (size == sizeof(__guard)) return; } } #endif - /* If sysctl was unsuccessful, use the "terminator canary". */ - __guard = 0xFF0A0D00UL; /* Everything failed? Or we are using a weakened model of the * terminator canary */ -- cgit v1.2.3