Skip to content

Commit

Permalink
net/ice: refactor raw pattern parsing function
Browse files Browse the repository at this point in the history
Replace strlen with more secure strnlen in ice_hash_parse_raw_pattern.

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Signed-off-by: 0-day Robot <robot@bytheb.org>
  • Loading branch information
vmedvedk authored and ovsrobot committed Jul 22, 2024
1 parent 75d5297 commit 289cdde
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/net/ice/ice_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 289cdde

Please sign in to comment.