From 35bf0dc2d01c7b90f6c264ac7c5f737a751b0734 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 4 Apr 2004 13:32:34 +0000 Subject: [PATCH] update from glibc --- lib/argp-help.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/argp-help.c b/lib/argp-help.c index e82f488353..61acecd619 100644 --- a/lib/argp-help.c +++ b/lib/argp-help.c @@ -1,5 +1,5 @@ /* Hierarchial argument parsing help output - Copyright (C) 1995-2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1995-2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . @@ -46,6 +46,7 @@ char *alloca (); #include #include #include +#include #ifdef USE_IN_LIBIO # include #endif @@ -451,8 +452,10 @@ make_hol (const struct argp *argp, struct hol_cluster *cluster) hol->entries = malloc (sizeof (struct hol_entry) * hol->num_entries); hol->short_options = malloc (num_short_options + 1); - assert (hol->entries && hol->short_options - && hol->num_entries <= SIZE_MAX / sizeof (struct hol_entry)); + assert (hol->entries && hol->short_options); +#if SIZE_MAX <= UINT_MAX + assert (hol->num_entries <= SIZE_MAX / sizeof (struct hol_entry)); +#endif /* Fill in the entries. */ so = hol->short_options; @@ -845,8 +848,10 @@ hol_append (struct hol *hol, struct hol *more) char *short_options = malloc (hol_so_len + strlen (more->short_options) + 1); - assert (entries && short_options - && num_entries <= SIZE_MAX / sizeof (struct hol_entry)); + assert (entries && short_options); +#if SIZE_MAX <= UINT_MAX + assert (num_entries <= SIZE_MAX / sizeof (struct hol_entry)); +#endif __mempcpy (__mempcpy (entries, hol->entries, hol->num_entries * sizeof (struct hol_entry)), -- 2.30.2