Skip to content
This repository has been archived by the owner on Apr 24, 2019. It is now read-only.

Commit

Permalink
Add a check to -v to error when invalid.
Browse files Browse the repository at this point in the history
Currently -v will take a value higher than 255 and just silently
overflow. This is an unintuitive behavior and causes weird issues
when you overflow.
  • Loading branch information
gmjosack committed Jan 3, 2014
1 parent fe8ca3d commit ddec9f8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ucarp.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ int main(int argc, char *argv[])
break;
}
case 'v': {
if (strtoul(optarg, NULL, 0) > 255 || strtol(optarg, NULL, 0) < 1) {
logfile(LOG_ERR, _("vhid must be between 1 and 255."));
return 1;
}
vhid = (unsigned char) strtoul(optarg, NULL, 0);
break;
}
Expand Down

0 comments on commit ddec9f8

Please sign in to comment.