about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2022-10-13 05:45:41 +0200
committerFlorian Weimer <fweimer@redhat.com>2022-10-13 05:45:41 +0200
commit15a94e6668a6d7c5697e805d8d67f1d102d0d52e (patch)
treebd703f55d1e50d62cfa2572685a194f8eab81a4d
parentba0ca36132d72d88f577062520b479b4b97df114 (diff)
downloadglibc-15a94e6668a6d7c5697e805d8d67f1d102d0d52e.tar.gz
glibc-15a94e6668a6d7c5697e805d8d67f1d102d0d52e.tar.xz
glibc-15a94e6668a6d7c5697e805d8d67f1d102d0d52e.zip
malloc: Switch global_max_fast to uint8_t
MAX_FAST_SIZE is 160 at most, so a uint8_t is sufficient.  This makes
it harder to use memory corruption, by overwriting global_max_fast
with a large value, to fundamentally alter malloc behavior.

Reviewed-by: DJ Delorie <dj@redhat.com>
-rw-r--r--malloc/malloc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 953183e956..2a61c8b5ee 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -1757,7 +1757,7 @@ typedef struct malloc_chunk *mfastbinptr;
 #define set_contiguous(M)      ((M)->flags &= ~NONCONTIGUOUS_BIT)
 
 /* Maximum size of memory handled in fastbins.  */
-static INTERNAL_SIZE_T global_max_fast;
+static uint8_t global_max_fast;
 
 /*
    Set value of max_fast.