summaryrefslogtreecommitdiff
path: root/lib/ccan/tally
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2011-07-06 14:47:44 +0930
committerRusty Russell <rusty@rustcorp.com.au>2011-07-06 08:34:05 +0200
commitc019302e65051f214c5ea2ef908aa0ef79c8b12e (patch)
tree32a27b2393d2456a861b2d6ac5a9e5924c4b3f6b /lib/ccan/tally
parent44a016cd89e9421ab5938a0e52ec21774b438c99 (diff)
downloadsamba-c019302e65051f214c5ea2ef908aa0ef79c8b12e.tar.gz
samba-c019302e65051f214c5ea2ef908aa0ef79c8b12e.tar.bz2
samba-c019302e65051f214c5ea2ef908aa0ef79c8b12e.zip
ccan/tally: don't use SIZE_MAX.
Michael Adam points out this broke the build farm (ie. OSF1 axp V5.1 2650 alpha) so fixed in CCAN and imported from af7a902d74a7926693f55da9e21a67dde46931d4: Turns out it's not standard (thanks Samba build farm!) And the previous test had a hole in it anyway. This one is more conservative. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Autobuild-User: Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date: Wed Jul 6 08:34:05 CEST 2011 on sn-devel-104
Diffstat (limited to 'lib/ccan/tally')
-rw-r--r--lib/ccan/tally/tally.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/ccan/tally/tally.c b/lib/ccan/tally/tally.c
index b1839befe3..396474b250 100644
--- a/lib/ccan/tally/tally.c
+++ b/lib/ccan/tally/tally.c
@@ -27,8 +27,8 @@ struct tally *tally_new(unsigned buckets)
if (buckets == 0)
buckets = 1;
- /* Check for overflow. */
- if (buckets && SIZE_MAX / buckets < sizeof(tally->counts[0]))
+ /* Overly cautious check for overflow. */
+ if (sizeof(*tally) * buckets / sizeof(*tally) != buckets)
return NULL;
tally = malloc(sizeof(*tally) + sizeof(tally->counts[0])*(buckets-1));
if (tally) {