Make sure classifier string is null terminated

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
Adam Rutkowski 2022-04-08 16:10:47 +02:00 committed by Michal Mielewczyk
parent 531c7856bd
commit 5bcba78e7f

View File

@ -203,6 +203,10 @@ static int _cas_cls_string_ctr(struct cas_classifier *cls,
CAS_CLS_MSG(KERN_ERR, "String specifier is empty\n");
return -EINVAL;
}
if (len == MAX_STRING_SPECIFIER_LEN) {
CAS_CLS_MSG(KERN_ERR, "String specifier is too long\n");
return -EINVAL;
}
ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
if (!ctx)