summaryrefslogtreecommitdiff
path: root/libc/sysdeps
diff options
context:
space:
mode:
authorNed Ludd <solar@gentoo.org>2005-02-08 19:28:46 +0000
committerNed Ludd <solar@gentoo.org>2005-02-08 19:28:46 +0000
commitc19bb129a9bf66013f65d729c6c5913c225f09dd (patch)
treec817c201a4976cd470f906eff891f803f16e49f0 /libc/sysdeps
parentbc8dffb046a43a16cf928034dea93d4bac1043e0 (diff)
- 1/NN patches for ssp
Diffstat (limited to 'libc/sysdeps')
-rw-r--r--libc/sysdeps/linux/common/ssp.c13
1 files changed, 7 insertions, 6 deletions
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 */