From: Dave Hart Date: Fri, 5 Feb 2010 05:07:21 +0000 (+0000) Subject: Attempts to cure CID 108 CID 118 CID 119 TAINTED_SCALAR warnings. X-Git-Tag: NTP_4_2_7P17~1^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4170601ad772a17ef7160b1c951011b125d90cf6;p=thirdparty%2Fntp.git Attempts to cure CID 108 CID 118 CID 119 TAINTED_SCALAR warnings. Broaden ylwrap workaround VPATH_HACK to all non-GNU make. bk: 4b6ba789fNpbO0GqhtvVoV2KLHHLOw --- diff --git a/ChangeLog b/ChangeLog index cc8636851..bc3bdb7f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ +* Attempts to cure CID 108 CID 118 CID 119 TAINTED_SCALAR warnings. +* Broaden ylwrap workaround VPATH_HACK to all non-GNU make. (4.2.7p16) 2010/02/04 Released by Harlan Stenn * Include (4.2.6p1-RC4) - [Bug 1474] ntp_keygen LCRYPTO after libntp.a. * Include (4.2.6p1-RC4) - Remove arlib. @@ -74,6 +76,10 @@ * [Bug 1414] Enable "make distcheck" success with BSD make. (4.2.7) 2009/12/09 Released by Harlan Stenn * [Bug 1407] configure.ac: recent GNU Make -v does not include "version". +--- + +* [Bug 1477] 1st non-gmake make in clone w/VPATH can't make COPYRIGHT. + --- (4.2.6p1-RC4) 2010/02/04 Released by Harlan Stenn diff --git a/include/ntp_debug.h b/include/ntp_debug.h index 55b2e1a76..d07323b85 100644 --- a/include/ntp_debug.h +++ b/include/ntp_debug.h @@ -8,6 +8,8 @@ #ifndef NTP_DEBUG_H #define NTP_DEBUG_H +#include "ntp_assert.h" + /* * macros for debugging output - cut down on #ifdef pollution in the code */ diff --git a/m4/ntp_vpathhack.m4 b/m4/ntp_vpathhack.m4 index 43aea6236..7099fe88d 100644 --- a/m4/ntp_vpathhack.m4 +++ b/m4/ntp_vpathhack.m4 @@ -1,29 +1,43 @@ dnl ###################################################################### dnl NTP_VPATH_HACK dnl -dnl Are we using FreeBSD's make? +dnl Compiling ntpd doesn't require YACC or Bison unless ntp_parser.y is +dnl modified, because the output ntp_parser.[ch] are committed. This +dnl raises an issue with Automake-generated Makefiles on non-GNU make +dnl used from a build tree outside the source tree. +dnl +dnl With GNU make, ylwrap updates $srcdir/ntp_parser.[ch] directly. +dnl Under Sun or BSD make, ylwrap needs those files to be in the build +dnl tree. +dnl +dnl With VPATH_HACK enabled, ntpd/Makefile.am includes code to symlink +dnl from ntp_parser.[ch] in the build tree to the corresponding files +dnl in $srcdir, and to check for ylwrap replacing the .h with a normal +dnl file, and in that case copy the updated .h to $srcdir and restore +dnl the symlink. +dnl dnl if we are building outside the srcdir and either -dnl force_ntp_vpath_hack is set +dnl force_ntp_vpath_hack is yes dnl or -dnl we're on freebsd and not using GNU make -dnl then we want VPATH_HACK to be true in automake tests +dnl we're not using GNU make +dnl then we want VPATH_HACK to be true for .am tests dnl AC_DEFUN([NTP_VPATH_HACK], [ -AC_MSG_CHECKING([to see if we need a VPATH hack]) +AC_MSG_CHECKING([to see if we need ylwrap VPATH hack]) ntp_vpath_hack="no" -case "$srcdir::$build_os::${force_ntp_vpath_hack+set}" in - .::*::*) - ;; - *::*::set) +case "$srcdir::${force_ntp_vpath_hack-no}" in + .::*) + ;; # VPATH_HACK path is for VPATH builds only. + *::yes) ntp_vpath_hack="yes" ;; - *::freebsd*::) + *::*) case "`${MAKE-make} -v -f /dev/null 2>/dev/null | grep 'GNU Make'`" in '') ntp_vpath_hack="yes" esac esac -AC_MSG_RESULT($ntp_vpath_hack) +AC_MSG_RESULT([$ntp_vpath_hack]) AM_CONDITIONAL([VPATH_HACK], [test x$ntp_vpath_hack = xyes]) ]) dnl ====================================================================== diff --git a/ntpd/Makefile.am b/ntpd/Makefile.am index dbf9df473..69dd70772 100644 --- a/ntpd/Makefile.am +++ b/ntpd/Makefile.am @@ -64,9 +64,9 @@ vphack_after: ) # BUILT_SOURCES which should also be in EXTRA_DIST -B_S_DIST= \ - ntpd-opts.c \ - ntpd-opts.h \ +B_S_DIST= \ + $(srcdir)/ntpd-opts.c \ + $(srcdir)/ntpd-opts.h \ $(NULL) BUILT_SOURCES= \ diff --git a/ntpd/ntp_scanner.c b/ntpd/ntp_scanner.c index 009b798d1..883bd59b0 100644 --- a/ntpd/ntp_scanner.c +++ b/ntpd/ntp_scanner.c @@ -120,14 +120,21 @@ FGETC( struct FILE_INFO *stream ) { - int ch = fgetc(stream->fd); + int ch; + + ch = fgetc(stream->fd); - ++stream->col_no; - if (ch == '\n') { - stream->prev_line_col_no = stream->col_no; - ++stream->line_no; - stream->col_no = 1; + if (EOF != ch) { + NTP_INSIST(CHAR_MIN <= ch && ch <= CHAR_MAX); + + ++stream->col_no; + if (ch == '\n') { + stream->prev_line_col_no = stream->col_no; + ++stream->line_no; + stream->col_no = 1; + } } + return ch; } diff --git a/ntpd/work_fork.c b/ntpd/work_fork.c index ba93550c1..87e271760 100644 --- a/ntpd/work_fork.c +++ b/ntpd/work_fork.c @@ -172,9 +172,15 @@ receive_blocking_req_internal( req = NULL; trycount = 3; - do + do { + NLOG(NLOG_SYSEVENT) { + if (trycount < 3) + msyslog(LOG_NOTICE, + "receive_blocking_req_internal read try #%d", + 4 - trycount); + } rc = read(child_req_read_pipe, &hdr, sizeof(hdr)); - while (--trycount && !rc); + } while (--trycount && !rc); if (rc < 0) msyslog(LOG_ERR, @@ -186,6 +192,7 @@ receive_blocking_req_internal( "receive_blocking_req_internal: short header read %d of %d\n", rc, sizeof(hdr)); else { + NTP_INSIST(sizeof(hdr) < hdr.octets && hdr.octets < 4 * 1024); req = emalloc(hdr.octets); memcpy(req, &hdr, sizeof(*req)); @@ -265,6 +272,7 @@ receive_blocking_resp_internal( DPRINTF(1, ("receive_blocking_resp_internal: header mismatch (0x%x)\n", hdr.magic_sig)); else { + NTP_INSIST(sizeof(hdr) < hdr.octets && hdr.octets < 16 * 1024); resp = emalloc(hdr.octets); memcpy(resp, &hdr, sizeof(*resp));