Skip to content

Commit

Permalink
address code review comment: add strnlen return value check
Browse files Browse the repository at this point in the history
  • Loading branch information
eparshut committed May 17, 2024
1 parent 04095c0 commit f21819c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/ittnotify/jitprofiling.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ static int isValidAbsolutePath(char *path, size_t maxPathLength)
}

size_t pathLength = strnlen(path, maxPathLength);
if (pathLength == maxPathLength)
{
/* The strnlen() function returns maxPathLength if there is no null terminating
* among the first maxPathLength characters in the string pointed to by path.
*/
return 0;
}

if (pathLength > 2)
{
Expand Down

0 comments on commit f21819c

Please sign in to comment.