Skip to content

Commit

Permalink
proc_portLookup: fix len check
Browse files Browse the repository at this point in the history
If server returned off by 1 value, it wasn't detected
and resulted in memcpy with size -1.

JIRA: RTOS-897
  • Loading branch information
lukileczo committed Aug 26, 2024
1 parent fa2cb46 commit b773d57
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions proc/name.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,11 @@ int proc_portLookup(const char *name, oid_t *file, oid_t *dev)
break;
}

if (i + err > len) {
i += err + 1;
if (i > len) {
err = -EINVAL;
break;
}

i += err + 1;
} while (i != len);

if (file != NULL)
Expand Down

0 comments on commit b773d57

Please sign in to comment.