[v3,2/3] net/ice: refactor raw pattern parsing function
Checks
Commit Message
Replace strlen with more secure strnlen in ice_hash_parse_raw_pattern.
Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
---
drivers/net/ice/ice_hash.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
@@ -658,9 +658,9 @@ ice_hash_parse_raw_pattern(struct ice_adapter *ad,
raw_spec = item->spec;
raw_mask = item->mask;
- spec_len = strlen((char *)(uintptr_t)raw_spec->pattern);
- if (strlen((char *)(uintptr_t)raw_mask->pattern) !=
- spec_len)
+ spec_len = strnlen((char *)(uintptr_t)raw_spec->pattern, raw_spec->length);
+ if (strnlen((char *)(uintptr_t)raw_mask->pattern, raw_spec->length) !=
+ spec_len)
return -rte_errno;
pkt_len = spec_len / 2;