[Git][NTPsec/ntpsec][master] Squash warning on NetBSD 9.0

Hal Murray gitlab at mg.gitlab.com
Fri Feb 21 01:53:43 UTC 2020



Hal Murray pushed to branch master at NTPsec / ntpsec


Commits:
d9b141a1 by Hal Murray at 2020-02-20T17:53:19-08:00
Squash warning on NetBSD 9.0

../../ntpd/ntp_control.c:1476:34: warning: '%s' directive output may be truncated writing up to 255 bytes into a region of size between 0 and 255 [-Wformat-truncation=]
                snprintf(str, sizeof(str), "%s/%s", utsnamebuf.sysname,
                         utsnamebuf.release);

It wants us to check the return code or use %.<n>s to limit
the size.

- - - - -


1 changed file:

- ntpd/ntp_control.c


Changes:

=====================================
ntpd/ntp_control.c
=====================================
@@ -1473,7 +1473,7 @@ ctl_putsys(
 		break;
 
 	case CS_SYSTEM:
-		snprintf(str, sizeof(str), "%s/%s", utsnamebuf.sysname,
+		snprintf(str, sizeof(str), "%.100s/%.100s", utsnamebuf.sysname,
 			 utsnamebuf.release);
 		ctl_putstr(sys_var[CS_SYSTEM].text, str, strlen(str));
 		break;



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/d9b141a1da0415681667f2cd6038d798d595fb27

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/d9b141a1da0415681667f2cd6038d798d595fb27
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20200221/07f7be63/attachment-0001.htm>


More information about the vc mailing list