diff options
author | Ulrich Drepper <drepper@redhat.com> | 2003-09-25 05:38:48 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2003-09-25 05:38:48 +0000 |
commit | 32868f8801a4800dd9f2b1597e7499ec76cf8dd1 (patch) | |
tree | e7d6ba6731729f6574f69d45ca52824f81afd251 /argp | |
parent | c706f2a34d1216c9b22aad4265317f92f3189cec (diff) | |
download | glibc-32868f8801a4800dd9f2b1597e7499ec76cf8dd1.zip glibc-32868f8801a4800dd9f2b1597e7499ec76cf8dd1.tar.gz glibc-32868f8801a4800dd9f2b1597e7499ec76cf8dd1.tar.bz2 |
Update.
2003-09-24 Paul Eggert <eggert@twinsun.com>
* argp/argp-fmtstream.c (__argp_fmtstream_ensure): Check for
size_t overflow when reallocating storage.
* argp/argp-help.c (make_hol, hol_append): Likewise.
(SIZE_MAX): New macro.
Diffstat (limited to 'argp')
-rw-r--r-- | argp/argp-help.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/argp/argp-help.c b/argp/argp-help.c index 8acc62d..3a2cfb4 100644 --- a/argp/argp-help.c +++ b/argp/argp-help.c @@ -73,6 +73,10 @@ char *alloca (); #include "argp.h" #include "argp-fmtstream.h" #include "argp-namefrob.h" + +#ifndef SIZE_MAX +# define SIZE_MAX ((size_t) -1) +#endif /* User-selectable (using an environment variable) formatting parameters. @@ -441,7 +445,8 @@ 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); + assert (hol->entries && hol->short_options + && hol->num_entries <= SIZE_MAX / sizeof (struct hol_entry)); /* Fill in the entries. */ so = hol->short_options; @@ -834,6 +839,9 @@ 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)); + __mempcpy (__mempcpy (entries, hol->entries, hol->num_entries * sizeof (struct hol_entry)), more->entries, |