Commit e5b1174f authored by 's avatar
Browse files

add checking for field argument

git-svn-id: file:///home/svn/mapi/trunk@913 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent e6f84390
......@@ -567,9 +567,24 @@ static int topx_instance(mapidflib_function_instance_t *instance,
instance->def->shm_size=sizeof(struct topx_result) * x + sizeof(unsigned int);
int protocol = getargint(&fargs);
if(protocol!=TOPX_IP && protocol!=TOPX_TCP && protocol!=TOPX_UDP)
return MFUNCT_INVALID_ARGUMENT_2;
int field = getargint(&fargs);
if(field < TOPX_IP_TOS || field > TOPX_UDP_CHECKSUM) // add checking for field argument
return MFUNCT_INVALID_ARGUMENT_3;
if(protocol == TOPX_IP && (field < TOPX_IP_TOS || field > TOPX_IP_DSTIP))
return MFUNCT_INVALID_ARGUMENT_3;
if(protocol == TOPX_TCP && (field < TOPX_TCP_SRCPORT || field > TOPX_TCP_URGENT))
return MFUNCT_INVALID_ARGUMENT_3;
if(protocol == TOPX_UDP && (field < TOPX_UDP_SRCPORT || field > TOPX_UDP_CHECKSUM))
return MFUNCT_INVALID_ARGUMENT_3;
return(0);
}
......@@ -589,6 +604,19 @@ static int topx_init(mapidflib_function_instance_t *instance, MAPI_UNUSED int fd
return MFUNCT_INVALID_ARGUMENT_2;
field = getargint(&fargs);
if(field < TOPX_IP_TOS || field > TOPX_UDP_CHECKSUM) // add checking for field argument
return MFUNCT_INVALID_ARGUMENT_3;
if(protocol == TOPX_IP && (field < TOPX_IP_TOS || field > TOPX_IP_DSTIP))
return MFUNCT_INVALID_ARGUMENT_3;
if(protocol == TOPX_TCP && (field < TOPX_TCP_SRCPORT || field > TOPX_TCP_URGENT))
return MFUNCT_INVALID_ARGUMENT_3;
if(protocol == TOPX_UDP && (field < TOPX_UDP_SRCPORT || field > TOPX_UDP_CHECKSUM))
return MFUNCT_INVALID_ARGUMENT_3;
sortby = getargint(&fargs);
reset_interval = getargint(&fargs);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment