From ca0e8255eaa3ab1985cfa0bb4bbd68eecb00c99a Mon Sep 17 00:00:00 2001 From: "7u83@mail.ru" <7u83@mail.ru@noemail.net> Date: Sun, 15 Mar 2015 09:01:06 +0000 Subject: [PATCH] Added some error checking. FossilOrigin-Name: 7583b428afd42091129e4c2a588b23012f972f42e2be0c3fe3968c4172aaca4d --- src/capwap/cw_readelem_ac_name.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/capwap/cw_readelem_ac_name.c b/src/capwap/cw_readelem_ac_name.c index ebd2941b..d11b1d6f 100644 --- a/src/capwap/cw_readelem_ac_name.c +++ b/src/capwap/cw_readelem_ac_name.c @@ -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; }