diff options
author | Jakub Jelinek <jakub@redhat.com> | 2004-09-27 06:18:18 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2004-09-27 06:18:18 +0000 |
commit | f1750fb9c68854778e6e023ed490ff80e1c90167 (patch) | |
tree | 416f6a0fabb42abbdafde8965810adb5abcf0283 /elf | |
parent | efaf80c5d05102f75864847140bfb8b2bdbd4523 (diff) | |
download | glibc-f1750fb9c68854778e6e023ed490ff80e1c90167.tar.gz glibc-f1750fb9c68854778e6e023ed490ff80e1c90167.tar.xz glibc-f1750fb9c68854778e6e023ed490ff80e1c90167.zip |
Updated to fedora-glibc-20040927T0611 cvs/fedora-glibc-2_3_3-59
Diffstat (limited to 'elf')
-rw-r--r-- | elf/dl-support.c | 20 | ||||
-rw-r--r-- | elf/readlib.c | 10 |
2 files changed, 19 insertions, 11 deletions
diff --git a/elf/dl-support.c b/elf/dl-support.c index e3df749ae5..8bf6814de2 100644 --- a/elf/dl-support.c +++ b/elf/dl-support.c @@ -257,22 +257,22 @@ _dl_non_dynamic_init (void) if (__libc_enable_secure) { - static const char *unsecure_envvars[] = - { - UNSECURE_ENVVARS, + static const char unsecure_envvars[] = + UNSECURE_ENVVARS #ifdef EXTRA_UNSECURE_ENVVARS EXTRA_UNSECURE_ENVVARS #endif - }; - size_t cnt; + ; + const char *cp = unsecure_envvars; - for (cnt = 0; - cnt < sizeof (unsecure_envvars) / sizeof (unsecure_envvars[0]); - ++cnt) - unsetenv (unsecure_envvars[cnt]); + while (cp < unsecure_envvars + sizeof (unsecure_envvars)) + { + __unsetenv (cp); + cp = (const char *) __rawmemchr (cp, '\0') + 1; + } if (__access ("/etc/suid-debug", F_OK) != 0) - unsetenv ("MALLOC_CHECK_"); + __unsetenv ("MALLOC_CHECK_"); } #ifdef DL_PLATFORM_INIT diff --git a/elf/readlib.c b/elf/readlib.c index a1fec94589..4fbc3e5e4c 100644 --- a/elf/readlib.c +++ b/elf/readlib.c @@ -105,7 +105,15 @@ process_file (const char *real_file_name, const char *file_name, if ((size_t) statbuf.st_size < sizeof (struct exec) || (size_t) statbuf.st_size < sizeof (ElfW(Ehdr))) { - error (0, 0, _("File %s is too small, not checked."), file_name); + if (statbuf.st_size == 0) + error (0, 0, _("File %s is empty, not checked."), file_name); + else + { + char buf[SELFMAG]; + size_t n = MIN (statbuf.st_size, SELFMAG); + if (fread (buf, n, 1, file) == 1 && memcmp (buf, ELFMAG, n) == 0) + error (0, 0, _("File %s is too small, not checked."), file_name); + } fclose (file); return 1; } |