[Git][NTPsec/ntpsec][master] Fix a couple more gcc 8 warnings, #479

Hal Murray gitlab at mg.gitlab.com
Fri Apr 20 11:51:44 UTC 2018


Hal Murray pushed to branch master at NTPsec / ntpsec


Commits:
3d229805 by Hal Murray at 2018-04-20T11:49:05Z
Fix a couple more gcc 8 warnings, #479

Still more in tests/ntpd/leapsec.c

- - - - -


2 changed files:

- ntpd/refclock_generic.c
- ntpd/refclock_neoclock.c


Changes:

=====================================
ntpd/refclock_generic.c
=====================================
--- a/ntpd/refclock_generic.c
+++ b/ntpd/refclock_generic.c
@@ -4120,16 +4120,15 @@ gps16x_message(
 					char buffer[128];
 
 					get_mbg_ascii_msg(&bufp, &gps_ascii_msg);
-
+					strncpy(buffer, "gps_message=", sizeof(buffer));
 					if (gps_ascii_msg.valid)
 						{
 							char buffer1[128];
 							mkreadable(buffer1, sizeof(buffer1), gps_ascii_msg.s, strlen(gps_ascii_msg.s), (int)0);
-
-							snprintf(buffer, sizeof(buffer), "gps_message=\"%s\"", buffer1);
+							strlcat(buffer, buffer1, sizeof(buffer));
 						}
 					else
-						snprintf(buffer, sizeof(buffer), "gps_message=<NONE>");
+						strlcat(buffer, "<None>", sizeof(buffer));
 
 					set_var(&parse->kv, buffer, sizeof(buffer), RO|DEF);
 				}


=====================================
ntpd/refclock_neoclock.c
=====================================
--- a/ntpd/refclock_neoclock.c
+++ b/ntpd/refclock_neoclock.c
@@ -660,8 +660,8 @@ neoclock4x_control(int unit,
 	       up->utc_year, up->utc_month, up->utc_day,
 	       up->utc_hour, up->utc_minute, up->utc_second,
 	       up->utc_msec);
-      tt = add_var(&out->kv_list, sizeof(tmpbuf)-1, RO|DEF);
-      snprintf(tt, sizeof(tmpbuf)-1, "calc_utc=\"%s\"", tmpbuf);
+      tt = add_var(&out->kv_list, sizeof(tmpbuf)+20, RO|DEF);
+      snprintf(tt, sizeof(tmpbuf)+20, "calc_utc=\"%s\"", tmpbuf);
 
 #define MAXINTSIZE	20	/* max % of decimal digits in integer */
 #define S_RADIOSIGNAL	sizeof(up->radiosignal) + 15



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/3d2298050ddf88c86bb10d0be58a166c8a8cc772

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/3d2298050ddf88c86bb10d0be58a166c8a8cc772
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/20180420/3e94aae1/attachment.html>


More information about the vc mailing list