Preserve limitation of "TCP_CA_NAME_MAX" when matching the algorithm

name.

MFC after:	3 days
Suggested by:	gnn @
This commit is contained in:
Hans Petter Selasky 2014-10-27 16:08:41 +00:00
parent f42d8dec6c
commit 614b50ae8b

View File

@ -107,7 +107,8 @@ cc_default_algo(SYSCTL_HANDLER_ARGS)
CC_LIST_RLOCK();
STAILQ_FOREACH(funcs, &cc_list, entries) {
/* NOTE: "newptr" is not zero terminated */
if (req->newlen != strlen(funcs->name))
if (req->newlen != strnlen(funcs->name,
TCP_CA_NAME_MAX - 1))
continue;
if (bcmp(req->newptr, funcs->name, req->newlen))
continue;