sbin/hammer: check strtol()/strtoll() results to avoid irrelevant history
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Wed, 18 Feb 2015 17:07:03 +0000 (02:07 +0900)
committerTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Wed, 18 Feb 2015 19:08:22 +0000 (04:08 +0900)
commit8f10d7e0b43182923754be9e737ca80112fb1cb8
treed2e69e3f7536d8f5bda816a314619a71dc952ebc
parent8a28dcf677ac7e8b4020fcd7acdfec789d5fe3b4
sbin/hammer: check strtol()/strtoll() results to avoid irrelevant history
queries

- Check errno for possible overflow/underflow by strtol()/strtoll() in
  order to avoid ioctl with irrelevant offset/length.

- Examples
  # hammer -vvv history@11111111111111111111111111111111,111 ./out
  Result too large: @11111111111111111111111111111111
  # hammer -vvv history@111,11111111111111111111111111111111 ./out
  Result too large: ,11111111111111111111111111111111
  # hammer -vvv history@-11111111111111111111111111111111,111 ./out
  Result too large: @-11111111111111111111111111111111
  # hammer -vvv history@111,-11111111111111111111111111111111 ./out
  Result too large: ,-11111111111111111111111111111111
sbin/hammer/cmd_history.c