diff options
author | Ulrich Drepper <drepper@redhat.com> | 2003-08-19 20:24:45 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2003-08-19 20:24:45 +0000 |
commit | 5dfe677810a3550bc2cff4d4046261c7572fbae0 (patch) | |
tree | b4e1e39f06f2f5c8e48d55eef6b24e6441001d92 | |
parent | 9a3a9dd8d9e03875f865a22de5296274cc18c10e (diff) | |
download | glibc-5dfe677810a3550bc2cff4d4046261c7572fbae0.zip glibc-5dfe677810a3550bc2cff4d4046261c7572fbae0.tar.gz glibc-5dfe677810a3550bc2cff4d4046261c7572fbae0.tar.bz2 |
Update.
* stdio-common/test-vfprintf.c (main): Don't write temporary file
into source directory.
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | malloc/malloc.c | 10 | ||||
-rw-r--r-- | stdio-common/test-vfprintf.c | 6 |
3 files changed, 14 insertions, 5 deletions
@@ -1,5 +1,8 @@ 2003-08-19 Ulrich Drepper <drepper@redhat.com> + * stdio-common/test-vfprintf.c (main): Don't write temporary file + into source directory. + * malloc/malloc.c (_int_free): Add cheap test for some invalid block sizes. diff --git a/malloc/malloc.c b/malloc/malloc.c index 55e2cbc..8cc9e45 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -4135,8 +4135,14 @@ _int_free(mstate av, Void_t* mem) allocator never wrapps around at the end of the address space. Therefore we can exclude some size values which might appear here by accident or by "design" from some intruder. */ - if ((uintptr_t) p > (uintptr_t) -size) - return; + if (__builtin_expect ((uintptr_t) p > (uintptr_t) -size, 0)) + { + if (check_action & 1) + fprintf (stderr, "free(): invalid pointer %p!\n", mem); + if (check_action & 2) + abort (); + return; + } check_inuse_chunk(av, p); diff --git a/stdio-common/test-vfprintf.c b/stdio-common/test-vfprintf.c index 50e8b50..a683eac 100644 --- a/stdio-common/test-vfprintf.c +++ b/stdio-common/test-vfprintf.c @@ -1,5 +1,5 @@ /* Tests of *printf for very large strings. - Copyright (C) 2000, 2002 Free Software Foundation, Inc. + Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2000. @@ -40,14 +40,14 @@ char large[50000]; int main (void) { - char buf[20]; + char buf[25]; size_t i; int res = 0; int fd; mtrace (); - strcpy (buf, "test-vfprintfXXXXXX"); + strcpy (buf, "/tmp/test-vfprintfXXXXXX"); fd = mkstemp (buf); if (fd == -1) { |