]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 1781] longlong undefined in sntp handle_pkt() on Debian amd64.
authorDave Hart <hart@ntp.org>
Sat, 8 Jan 2011 20:34:39 +0000 (20:34 +0000)
committerDave Hart <hart@ntp.org>
Sat, 8 Jan 2011 20:34:39 +0000 (20:34 +0000)
Bump deps-ver and sntp/deps-ver to force each directory to be cleaned once,
  to work around build breaks triggered by changing erealloc() and
  estrdup() from functions to macros.

bk: 4d28ca5fzkDKgNet3BaVEJfAY9a8Ag

ChangeLog
deps-ver
ntpd/ntp_control.c
ntpq/ntpq.c
sntp/Makefile.am
sntp/deps-ver
sntp/main.c
tests/libntp/Makefile.am

index 1a07c319b5dbff7bc1453e829175dc51e0451624..6cd1ebfdda77cece48400e7f117587e7779f713a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,5 @@
 * [Bug 1780] Windows ntpd 4.2.7p114 crashes in ioctl().
+* [Bug 1781] longlong undefined in sntp handle_pkt() on Debian amd64.
 (4.2.7p114) 2011/01/08 Released by Harlan Stenn <stenn@ntp.org>
 * Fix for openssl pkg-config detection eval failure.
 * Add erealloc_zero(), refactor estrdup(), emalloc(), emalloc_zero() to
index 9ad4b1451fd566408919dddd04e4cf31daf89aef..83750ad1bd368fa9827e5205f7724ab07c7c52cb 100644 (file)
--- a/deps-ver
+++ b/deps-ver
@@ -1 +1 @@
-Tue Nov 16 19:50:15 UTC 2010
+Sat Jan  8 18:11:35 UTC 2011
index 8163b72ee7f6307852de2a8823e7641ef610aef6..fb7881806970bd194fbfafaa1c34146c57b3f135 100644 (file)
@@ -2405,7 +2405,7 @@ ctl_putpeer(
        case CP_VARLIST:
                s = buf;
                be = buf + sizeof(buf);
-               if (s + strlen(peer_var[id].text) + 4 > be)
+               if (strlen(peer_var[id].text) + 4 > sizeof(buf))
                        break;  /* really long var name */
 
                snprintf(s, sizeof(buf), "%s=\"", peer_var[id].text);
index c6af615d54931cb2b7d64e416815b0461352ceb9..9d37ffdb1453fe8a5c273083cafd177335a86208 100644 (file)
@@ -2716,12 +2716,10 @@ nextvar(
        )
 {
        const char *cp;
-       char *np;
+       const char *np;
        const char *cpend;
        size_t srclen;
        size_t len;
-       char *npend;    /* character after last */
-       int quoted = 0;
        static char name[MAXVARLEN];
        static char value[MAXVALLEN];
 
@@ -2741,6 +2739,7 @@ nextvar(
         * over any white space and terminate it.
         */
        srclen = strcspn(cp, ",=\r\n");
+       srclen = max(srclen, (size_t)(cpend - cp));
        len = srclen;
        while (len > 0 && isspace(cp[len - 1]))
                len--;
@@ -2766,35 +2765,37 @@ nextvar(
         * So far, so good.  Copy out the value
         */
        cp++;   /* past '=' */
-       while (cp < cpend && (isspace((int)*cp) && *cp != '\r' && *cp != '\n'))
+       while (cp < cpend && (isspace(*cp) && *cp != '\r' && *cp != '\n'))
                cp++;
-       np = value;
-       npend = &value[MAXVALLEN];
-       while (cp < cpend && np < npend && ((*cp != ',') || quoted))
-       {
-               quoted ^= ((*np++ = *cp++) == '"');
+       np = cp;
+       if ('"' == *np) {
+               do {
+                       np++;
+               } while (np < cpend && '"' != *np);
+               if (np < cpend)
+                       np++;
+       } else {
+               while (np < cpend && ',' != *np)
+                       np++;
        }
-
-       /*
-        * Check if we overran the value buffer while still in a quoted string
-        * or without finding a comma
-        */
-       if (np == npend && (quoted || *cp != ','))
+       len = np - cp;
+       if (np >= cpend || ',' != *np || len >= sizeof(value))
                return 0;
+       memcpy(value, cp, len);
        /*
         * Trim off any trailing whitespace
         */
-       while (np > value && isspace((int)(*(np-1))))
-               np--;
-       *np = '\0';
+       while (len > 0 && isspace(value[len - 1]))
+               len--;
+       value[len] = '\0';
 
        /*
         * Return this.  All done.
         */
-       if (cp != cpend)
-               cp++;
-       *datap = cp;
-       *datalen = cpend - cp;
+       if (np < cpend)
+               np++;
+       *datap = np;
+       *datalen = cpend - np;
        *vvalue = value;
        return 1;
 }
index 82a6d93fd3b5e08edd44fc8a095cbd558ad09957..84af7397f258e049c6194cee15a7060a02c77162 100644 (file)
@@ -188,7 +188,7 @@ $(srcdir)/sntp-opts.texi: $(srcdir)/sntp-opts.def $(srcdir)/version.def $(srcdir
 $(srcdir)/sntp.html: $(srcdir)/sntp-opts.menu $(srcdir)/sntp-opts.texi $(srcdir)/sntp.texi $(srcdir)/version.texi
        cd $(srcdir) && ( makeinfo --force --html --no-split -o sntp.html sntp.texi || true )
 
-../libntp/libntp.a:
+../libntp/libntp.a: FRC
        cd ../libntp && $(MAKE) libntp.a
 
 libtool: $(LIBTOOL_DEPS)
index dd28e403adb6e76c77f0b18dcf8e249cfdbb9aa1..83750ad1bd368fa9827e5205f7724ab07c7c52cb 100644 (file)
@@ -1 +1 @@
-Fri Nov 13 17:21:31 UTC 2009
+Sat Jan  8 18:11:35 UTC 2011
index 7292d377361876b866fecec50ec44d329ae657f4..806428ba22282f0ff58d30bace2d5c403435dded 100644 (file)
@@ -205,7 +205,7 @@ handle_pkt (
        char *p_SNTP_PRETEND_TIME;
        time_t pretend_time;
 #if SIZEOF_TIME_T == 8
-       longlong ll;
+       long long ll;
 #else
        long l;
 #endif
index c82d41fae522970e93831ef817c4f92e9d150cb4..7f8ec4415279bcf571b5789956b185d8b75d1b21 100644 (file)
@@ -1,5 +1,5 @@
 check_PROGRAMS = tests
-LDADD = @LCRYPTO@ @GTEST_LDFLAGS@ @GTEST_LIBS@ @top_builddir@/libntp/libntp.a
+LDADD = @top_builddir@/libntp/libntp.a @LCRYPTO@ @GTEST_LDFLAGS@ @GTEST_LIBS@
 AM_CXXFLAGS = @GTEST_CXXFLAGS@
 AM_CPPFLAGS = @GTEST_CPPFLAGS@
 tests_SOURCES = $(top_srcdir)/sntp/tests_main.cpp      \