]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-5819: fix bounds check on enum type
authorMichael Jerris <mike@jerris.com>
Sat, 28 Sep 2013 01:27:52 +0000 (21:27 -0400)
committerMichael Jerris <mike@jerris.com>
Sat, 28 Sep 2013 01:28:12 +0000 (21:28 -0400)
libs/sofia-sip/libsofia-sip-ua/sip/sip_feature.c

index b2940526b3c20505a8a8a915f993c4ea8a7e1671..e22b615aac877f3c0d810427ecc06a1adabd9b3a 100644 (file)
@@ -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;