Дана 26/03/21 08:23PM, mtdxwb написа:
> This patch adds Nerd Font clock icons that change according to the
> current hour (12-hour format). The icons are chosen based on the
> hour string extracted via strftime(%I).

This is ok as a standalone patch.


> +     hour_int = atoi(hours);

Quoting https://man.openbsd.org/atoi#CAVEATS
> CAVEATS
>      atoi does no overflow checking, handles unsigned numbers poorly, 
>      and handles strings containing trailing extra characters (like 
>      “123abc”) poorly.  Careful use of strtol(3) and strtoul(3) can 
>      alleviate these problems, but strtonum(3) can be used to convert 
>      numbers from strings much more safely and easily.

strtonum(3) is OpenBSD-specific, but strtol(3) and strtoul(3) aren't, 
and should be preferred in a portable program.

Reply via email to