Re: [PATCH conntrack-tools] conntrack: fix compiler warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 17, 2022 at 04:42:52PM +0100, Florian Westphal wrote:
> .... those do not indicate bugs, but they are distracting.
> 
> 'exp_filter_add' at filter.c:513:2:
> __builtin_strncpy specified bound 16 equals destination size [-Wstringop-truncation]
> read_config_yy.y:1625: warning: '__builtin_snprintf' output may be truncated before the last format character [-Wformat-truncation=]
>  1625 |         snprintf(policy->name, CTD_HELPER_NAME_LEN, "%s", $2);
> read_config_yy.y:1399: warning: '__builtin_snprintf' output may be ...
>  1399 |         snprintf(conf.stats.logfile, FILENAME_MAXLEN, "%s", $2);
> read_config_yy.y:707: warning: '__builtin_snprintf' output may be ...
>   707 |         snprintf(conf.local.path, UNIX_PATH_MAX, "%s", $2);
> read_config_yy.y:179: warning: '__builtin_snprintf' output may be ...
>   179 |         snprintf(conf.lockfile, FILENAME_MAXLEN, "%s", $2);
> read_config_yy.y:124: warning: '__builtin_snprintf' output may be ...
>   124 |         snprintf(conf.logfile, FILENAME_MAXLEN, "%s", $2);
> 
> ... its because the _MAXLEN constants are one less than the output
> buffer size, i.e. could use either .._MAXLEN + 1 or sizeof, this uses
> sizeof().

LGTM, thanks



[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux