提交 42d7d865 authored 作者: Michael Jerris's avatar Michael Jerris

FS-5819: fix bounds check on enum type

上级 0be5614b
......@@ -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;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论