[Git][NTPsec/ntpsec][master] 3 commits: ntp_control: NULL is only kinda-sorta zero.
Gary E. Miller
gitlab at mg.gitlab.com
Mon Oct 22 20:50:08 UTC 2018
Gary E. Miller pushed to branch master at NTPsec / ntpsec
Commits:
712f84d3 by Gary E. Miller at 2018-10-22T20:16:03Z
ntp_control: NULL is only kinda-sorta zero.
- - - - -
ed899129 by Gary E. Miller at 2018-10-22T20:19:24Z
ntp_control: NULL is only kinda-sorta zero. remove extra newline.
- - - - -
acb2ecdc by Gary E. Miller at 2018-10-22T20:47:20Z
ntp_control: Stop potentially dereferencing a NULL pointer.
- - - - -
1 changed file:
- ntpd/ntp_control.c
Changes:
=====================================
ntpd/ntp_control.c
=====================================
@@ -2892,6 +2892,7 @@ write_variables(
const struct ctl_var *v;
int ext_var;
char *valuep;
+ char nulltxt[1] = { '\0' };
long val;
size_t octets;
char *vareqv;
@@ -2919,11 +2920,10 @@ write_variables(
* Look through the variables. Dump out at the first sign of
* trouble.
*/
- while ((v = ctl_getitem(sys_var, &valuep)) != 0) {
+ while (NULL != (v = ctl_getitem(sys_var, &valuep))) {
ext_var = 0;
if (v->flags & EOV) {
- if ((v = ctl_getitem(ext_sys_var, &valuep)) !=
- 0) {
+ if (NULL != (v = ctl_getitem(ext_sys_var, &valuep))) {
if (v->flags & EOV) {
ctl_error(CERR_UNKNOWNVAR);
return;
@@ -2937,6 +2937,9 @@ write_variables(
ctl_error(CERR_PERMISSION);
return;
}
+ if (NULL == valuep)
+ valuep = nulltxt;
+
errno = 0;
if (!ext_var &&
(*valuep == '\0' ||
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/5367d30df9dc92cae661550775e5e6c2c9a2c7b5...acb2ecdcabad2ab42e9c6352999e174dd102eb3f
--
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/5367d30df9dc92cae661550775e5e6c2c9a2c7b5...acb2ecdcabad2ab42e9c6352999e174dd102eb3f
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/20181022/bbfbe400/attachment-0001.html>
More information about the vc
mailing list