Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Commit

Permalink
Merge pull request #8 from datadancer/buffer-overflow-patch-1
Browse files Browse the repository at this point in the history
Length checking for argument __name
  • Loading branch information
michael1309 committed Feb 8, 2021
2 parents 2bfb4c8 + d66fb36 commit 9fbca7d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions driver/src/sick_generic_caller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ int main(int argc, char **argv)
{
if (strstr(argv_tmp[i], nameId) == argv_tmp[i])
{
if(strlen(argv_tmp[i] + strlen(nameId)) >= MAX_NAME_LEN){
ROS_ERROR("Program arguments: %s is too long.\n", nameId);
exit(-1);
}

strcpy(nameVal, argv_tmp[i] + strlen(nameId));
scannerName = nameVal;
}
Expand Down

0 comments on commit 9fbca7d

Please sign in to comment.