<div dir="ltr"><div>Thanks, I'll post a PR for fixes. Somehow I missed that NetBSD is not a regular runner of NUT CI farm, gotta address that too - great to have more points of view on code quality, especially when those extra eyes are not blind and quiet :)</div><div><br></div><div>It seems bumping all those buffers to [NUT_PATH_MAX+1]` (for the NUL ending char) helps, and seems a reasonable thing to do safely.</div><div><br></div><div>FWIW, the truncation problem showed up with default ./ci_build.sh run which found GCC (7), but the char subscripts only with CLANG (13), on my dormant NetBSD 9.2 VM.</div><div><br></div><div>Jim</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Mar 31, 2025 at 3:06 PM Greg Troxel via Nut-upsdev <<a href="mailto:nut-upsdev@alioth-lists.debian.net" target="_blank">nut-upsdev@alioth-lists.debian.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">common.c:4087:59: warning: '__builtin_snprintf' output may be truncated before the last format character [-Wformat-truncation=]<br>
<br>
snprintf(current_test_path, sizeof(current_test_path), "%s/%s", dirname, dirp->d_name);<br>
<br>
<br>
I get why there is the warning, why the code is defensive, and why it's<br>
unlikely to be an issue. I don't know what the right approach is;<br>
perhaps checking dirname and erroring out if it's > than the sizeof-64,<br>
or something like that?<br>
<br>
(not seeing this needs fixing, but I got only 4 warnings building)<br>
<br>
_______________________________________________<br>
Nut-upsdev mailing list<br>
<a href="mailto:Nut-upsdev@alioth-lists.debian.net" target="_blank">Nut-upsdev@alioth-lists.debian.net</a><br>
<a href="https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsdev" rel="noreferrer" target="_blank">https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsdev</a><br>
</blockquote></div>