Re: [hackers] [sbase] nl: add -l option || Quentin Rameau

From: FRIGN <dev_AT_frign.de>
Date: Tue, 10 Mar 2015 18:57:42 +0100

On Tue, 10 Mar 2015 13:55:51 +0100 (CET)
git_AT_suckless.org wrote:

Hey Quentin,

> +static int blines = 1;
> (...)
> + blines = estrtonum(EARGF(usage()), 0, UINT_MAX);

a better type for blines is "size_t", because there's no
reason to limit the number of adjacent lines to 2147483647.
Everything size-related should be consistently stored in
the integer-type meant to store sizes.
It may not be dramatic here, but int-overflows happen
quickly when you for instance have a byte counter.
For this reason, wc in sbase was broken for a long time.

I'll fix that as soon as I audit nl(1), but felt like
writing this mail for anybody who's interested. :)

Cheers

FRIGN

-- 
FRIGN <dev_AT_frign.de>
Received on Tue Mar 10 2015 - 18:57:42 CET

This archive was generated by hypermail 2.3.0 : Tue Mar 10 2015 - 19:00:17 CET