Added some error checking.

FossilOrigin-Name: 7583b428afd42091129e4c2a588b23012f972f42e2be0c3fe3968c4172aaca4d
This commit is contained in:
7u83@mail.ru 2015-03-15 09:01:06 +00:00
parent c5d4aa9cdd
commit ca0e8255ea

View File

@ -19,11 +19,19 @@
#include "capwap.h"
#include "cw_util.h"
#include "cw_log.h"
int cw_readelem_ac_name(uint8_t **dst, int type,uint8_t *msgelem, int len)
{
if (type != CWMSGELEM_AC_NAME)
return 0;
if (len > 512 ) {
cw_dbg(DBG_CW_RFC,"AC name too long, max. 512 bytes allowed (RFC 5415)");
cw_dbg(DBG_CW_MSG_ERR,"AC name truncated to 512 bytes");
len = 512;
}
cw_setstr(dst,msgelem,len);
return 1;
}