From 0 Mon Sep 17 00:00:00 2001 From: Mikhail Efremov Date: Wed, 30 Aug 2017 17:27:44 +0300 Subject: [PATCH 25] Apply dhcp-4.3.5-bound.diff Thanks gremlin@. diff --git a/dhcp/omapip/hash.c b/dhcp/omapip/hash.c index defaced..defaced 100644 --- a/dhcp/omapip/hash.c +++ b/dhcp/omapip/hash.c @@ -343,10 +343,15 @@ do_ip4_hash(const void *key, unsigned len, unsigned size) unsigned char * hash_report(struct hash_table *table) { + +#define INT32_MAX_N 2147483647 /* 0x7FFFFFFF */ +#define INT32_MAX_S "2147483647" + static unsigned char retbuf[sizeof("Contents/Size (%): " - "2147483647/2147483647 " - "(2147483647%). " - "Min/max: 2147483647/2147483647")]; + INT32_MAX_S "/ " INT32_MAX_S + "(" INT32_MAX_S "%). " + "Min/max: " + INT32_MAX_S "/" INT32_MAX_S)]; unsigned curlen, pct, contents=0, minlen=UINT_MAX, maxlen=0; unsigned i; struct hash_bucket *bp; @@ -379,11 +384,11 @@ hash_report(struct hash_table *table) else pct = (contents * 100) / table->hash_count; - if (contents > 2147483647 || - table->hash_count > 2147483647 || - pct > 2147483647 || - minlen > 2147483647 || - maxlen > 2147483647) + if (contents > (INT32_MAX_N - 1) || + table->hash_count > (INT32_MAX_N - 1) || + pct > (INT32_MAX_N - 1) || + minlen > (INT32_MAX_N - 1) || + maxlen > (INT32_MAX_N - 1)) return (unsigned char *) "Report out of range for display."; sprintf((char *)retbuf,