[Git][NTPsec/ntpsec][master] 3 commits: ntpd/nts_server.c; Resolve oss-fuss issue 393742176, uninitialzed var.
Gary E. Miller (@garyedmundsmiller)
gitlab at mg.gitlab.com
Tue Feb 4 04:03:52 UTC 2025
Gary E. Miller pushed to branch master at NTPsec / ntpsec
Commits:
c22678bb by Gary E. Miller at 2025-02-03T19:41:30-08:00
ntpd/nts_server.c; Resolve oss-fuss issue 393742176, uninitialzed var.
- - - - -
4cfa8610 by Gary E. Miller at 2025-02-03T19:50:20-08:00
ntptime/ntptime.c: Fix gcc 14 warning on unitialized variable.
- - - - -
bb0b59a0 by Gary E. Miller at 2025-02-03T20:02:50-08:00
ntpd/ntp_scanner.c: Fix CC warning potential qsort(NULL,..)
baselist could have been NULL after the realloc.
- - - - -
3 changed files:
- ntpd/ntp_scanner.c
- ntpd/nts_server.c
- ntptime/ntptime.c
Changes:
=====================================
ntpd/ntp_scanner.c
=====================================
@@ -423,7 +423,8 @@ bool lex_push_file(
return false;
baselist = (char **)malloc(sizeof(char *));
if (NULL == baselist) {
- msyslog(LOG_ERR, "CONFIG: lex_push_file: NULL from malloc");
+ msyslog(LOG_ERR,
+ "CONFIG: lex_push_file: NULL from malloc");
exit(3);
}
while ((dp = readdir(dfd)) != NULL)
@@ -433,7 +434,13 @@ bool lex_push_file(
}
baselist[basecount++] = strdup(dp->d_name);
baselist = realloc(baselist,
- (size_t)(basecount+1) * sizeof(char *));
+ (size_t)(basecount+1) * sizeof(char *));
+ if (NULL == baselist) {
+ msyslog(LOG_ERR,
+ "CONFIG: lex_push_file: "
+ "NULL from realloc");
+ exit(3);
+ }
}
closedir(dfd);
qsort(baselist, (size_t)basecount, sizeof(char *),
=====================================
ntpd/nts_server.c
=====================================
@@ -381,10 +381,10 @@ bool nts_ke_request(SSL *ssl) {
* Our cookies can be 104, 136, or 168 for AES_SIV_CMAC_xxx
* 8*168 fits comfortably into 2K.
*/
- uint8_t buff[2048];
- uint8_t c2s[NTS_MAX_KEYLEN], s2c[NTS_MAX_KEYLEN];
- int aead, keylen;
- struct BufCtl_t buf;
+ uint8_t buff[2048] = {0};
+ uint8_t c2s[NTS_MAX_KEYLEN] = {0}, s2c[NTS_MAX_KEYLEN] = {0};
+ int aead = NO_AEAD, keylen;
+ struct BufCtl_t buf = {0};
int bytes_read, bytes_written;
int used;
@@ -394,7 +394,6 @@ bool nts_ke_request(SSL *ssl) {
buf.next = buff;
buf.left = bytes_read;
- aead = NO_AEAD;
if (!nts_ke_process_receive(&buf, &aead))
return false;
=====================================
ntptime/ntptime.c
=====================================
@@ -109,20 +109,20 @@ main(
struct ntptimeval ntv;
struct timeval tv;
struct timex ntx, _ntx;
- int times[20];
+ int times[20] = {0};
double ftemp, gtemp, htemp;
- long time_frac; /* ntv.time.tv_frac_sec (us/ns) */
+ long time_frac; // ntv.time.tv_frac_sec (us/ns)
l_fp ts;
- volatile unsigned ts_mask = TS_MASK; /* defaults to 20 bits (us) */
- volatile unsigned ts_roundbit = TS_ROUNDBIT; /* defaults to 20 bits (us) */
- volatile int fdigits = 6; /* fractional digits for us */
+ volatile unsigned ts_mask = TS_MASK; // defaults to 20 bits (us)
+ volatile unsigned ts_roundbit = TS_ROUNDBIT; // defaults to 20 bits (us)
+ volatile int fdigits = 6; // fractional digits for us
size_t c;
int ch;
int errflg = 0;
int cost = 0;
volatile bool json = false;
volatile int rawtime = 0;
- char ascbuf[BUFSIZ];
+ char ascbuf[BUFSIZ] = {0};
ZERO(ntx);
progname = argv[0];
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/compare/ddde55e49680137ba2bd58fb3d44e3340ebe6abc...bb0b59a0ffcb42e495fe42b555477ac7c6e211c4
--
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/compare/ddde55e49680137ba2bd58fb3d44e3340ebe6abc...bb0b59a0ffcb42e495fe42b555477ac7c6e211c4
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/20250204/83fb7e51/attachment-0001.htm>
More information about the vc
mailing list