From: Michael Jerris Date: Sat, 28 Sep 2013 01:27:52 +0000 (-0400) Subject: FS-5819: fix bounds check on enum type X-Git-Tag: v1.5.8~62 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=42d7d8651485109320bc1b9290ae13a376436409;p=thirdparty%2Ffreeswitch.git FS-5819: fix bounds check on enum type --- diff --git a/libs/sofia-sip/libsofia-sip-ua/sip/sip_feature.c b/libs/sofia-sip/libsofia-sip-ua/sip/sip_feature.c index b2940526b3..e22b615aac 100644 --- a/libs/sofia-sip/libsofia-sip-ua/sip/sip_feature.c +++ b/libs/sofia-sip/libsofia-sip-ua/sip/sip_feature.c @@ -116,7 +116,7 @@ static int sip_allow_update(msg_common_t *h, k->k_bitmap = 0; } else { - sip_method_t method = sip_method_code(name); + int method = (int)sip_method_code(name); if (method >= 0 && method < 32) k->k_bitmap |= 1 << method; @@ -130,14 +130,16 @@ int sip_is_allowed(sip_allow_t const *allow, sip_method_t method, char const *name) { - if (method < sip_method_unknown || !allow) + int met = method; + + if (meth < sip_method_unknown || !allow) return 0; - if (sip_method_unknown < method && method < 32) + if (sip_method_unknown < meth && meth < 32) /* Well-known method */ - return (allow->k_bitmap & (1 << method)) != 0; + return (allow->k_bitmap & (1 << meth)) != 0; - if (method == sip_method_unknown && + if (meth == sip_method_unknown && (allow->k_bitmap & (1 << sip_method_unknown)) == 0) return 0;