Skip to content

Commit

Permalink
Use field width of 9 on sscanf (fixes cppcheck portability issues)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobbi committed Jan 22, 2015
1 parent d9ff009 commit d27bb6d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/supertux/command_line_arguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ CommandLineArguments::parse_args(int argc, char** argv)
else
{
int width, height;
if (sscanf(argv[i], "%dx%d", &width, &height) != 2)
if (sscanf(argv[i], "%9dx%9d", &width, &height) != 2)
{
throw std::runtime_error("Invalid geometry spec, should be WIDTHxHEIGHT");
}
Expand Down Expand Up @@ -223,7 +223,7 @@ CommandLineArguments::parse_args(int argc, char** argv)
aspect_width = 0;
aspect_height = 0;
}
else if (sscanf(argv[i], "%d:%d", &aspect_width, &aspect_height) != 2)
else if (sscanf(argv[i], "%9d:%9d", &aspect_width, &aspect_height) != 2)
{
throw std::runtime_error("Invalid aspect spec, should be WIDTH:HEIGHT or auto");
}
Expand Down

0 comments on commit d27bb6d

Please sign in to comment.