Date:        Sun, 24 Nov 2019 13:49:56 +0600
    From:        Alexander Kuleshov <kuleshovm...@gmail.com>
    Message-ID:  
<canczxo6_3wprhkz2cfq3v0na4bwo3tgaja5emgfm1-qib45...@mail.gmail.com>

  | +            addr = strtol(optarg, &ep, 10);

  | Any comments?

strtol() returns a long, addr is just int - something needs to be
adjusted to avoid value truncation, depending upon what's acceptable,
maybe
        laddr = strtol(optarg, &ep, 10);
and then after the error checks (or merged in with them)
        if (laddr > INT_MAX)            /* < 0 test already happened */
                err("out of range");
        addr = (int)laddr;
(the cast is most likely not really needed).

Alternatively, maybe addr could be made long rather than int.  Depends
on how it is used.

Apart from that, where it is possible, removing uses of atoi() is
generally a good thing.

kre

Reply via email to