[Git][NTPsec/ntpsec][master] ntpd/refclock_generic.c: fix failed-timecode logging

Gary E. Miller (@garyedmundsmiller) gitlab at mg.gitlab.com
Mon Nov 9 20:59:28 UTC 2026



Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
4d537580 by Matt Selsky at 2026-11-09T12:56:38-08:00
ntpd/refclock_generic.c: fix failed-timecode logging

- - - - -


1 changed file:

- ntpd/refclock_generic.c


Changes:

=====================================
ntpd/refclock_generic.c
=====================================
@@ -1578,11 +1578,6 @@ static char *mkreadable(char *buffer,
         if (4 > blen) {
                 return NULL;            // don't bother with mini buffers
         }
-        if (2048 < srclen) {
-              /* Ugh, srclen underflowed somewhere.  Ignore ot.
-               * Coverity CID 583320 */
-            return NULL; 
-        }
 
         endb = buffer + blen - sizeof(ellipsis);
 
@@ -1592,7 +1587,7 @@ static char *mkreadable(char *buffer,
                 if (!hex &&                     // no binary only
                     (*src != '\\') &&           // no plain "\"
                     (*src != '"') &&            // no "
-                    isprint((int)*src)) {       // only printables
+                    isprint((unsigned char)*src)) { // only printables
                                                 // they are easy...
                         *buffer++ = *src++;
                         blen--;
@@ -3297,7 +3292,10 @@ parse_process(
                         {
                                 ERR(ERR_BADDATA)
                                         msyslog(LOG_WARNING, "REFCLOCK: PARSE receiver #%d: FAILED TIMECODE: \"%s\" (check receiver configuration / wiring)",
-                                                parse->peer->procptr->refclkunit, mkascii(buffer, sizeof buffer, tmpctl.parsegettc.parse_buffer, (unsigned)(tmpctl.parsegettc.parse_count - 1)));
+                                                parse->peer->procptr->refclkunit,
+                                                mkascii(buffer, sizeof buffer,
+                                                        tmpctl.parsegettc.parse_buffer,
+                                                        (unsigned)tmpctl.parsegettc.parse_count));
                         }
                         // copy status to show only changes in case of failures
                         parse->timedata.parse_status = parsetime->parse_status;



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

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/4d5375803cc9e66afce40fcf56af8587cd432fb1
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help


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


More information about the vc mailing list