Skip to content

Commit

Permalink
Fixed Minor issue
Browse files Browse the repository at this point in the history
Signed-off-by: R Chinmay <[email protected]>
  • Loading branch information
rchinmay committed Apr 2, 2021
1 parent 20e60c1 commit c65bc61
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions compiler/main/arg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,13 @@ static void process_arg(const ArgumentState* state,

case 'R':
if(desc->location) {
if (strlen(desc->type)!=1) {
int len = strlen(arg);
int maxLen = atoi(desc->type + 1);
if( len > maxLen ) {
USR_FATAL("argument for --%s is too long", desc->name);
}
}
(*((std::string*)desc->location)) = std::string(arg, std::min((int)strlen(arg), (int)FILENAME_MAX));
}
break;
Expand Down

0 comments on commit c65bc61

Please sign in to comment.