[Nut-upsdev] common/common.c snprintf warning
Greg Troxel
gdt at lexort.com
Mon Mar 31 13:51:14 BST 2025
common.c:4087:59: warning: '__builtin_snprintf' output may be truncated before the last format character [-Wformat-truncation=]
snprintf(current_test_path, sizeof(current_test_path), "%s/%s", dirname, dirp->d_name);
I get why there is the warning, why the code is defensive, and why it's
unlikely to be an issue. I don't know what the right approach is;
perhaps checking dirname and erroring out if it's > than the sizeof-64,
or something like that?
(not seeing this needs fixing, but I got only 4 warnings building)
More information about the Nut-upsdev
mailing list