]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
correct ntpq nextvar() warning cleanp
authorDave Hart <hart@ntp.org>
Sun, 9 Jan 2011 02:46:20 +0000 (02:46 +0000)
committerDave Hart <hart@ntp.org>
Sun, 9 Jan 2011 02:46:20 +0000 (02:46 +0000)
bk: 4d29217ciZlZ7BEs_Af26ltJuRKViA

ntpq/ntpq.c

index 9d37ffdb1453fe8a5c273083cafd177335a86208..b80794ef221e804f58cb83c131808f27f1897610 100644 (file)
@@ -2739,7 +2739,7 @@ nextvar(
         * over any white space and terminate it.
         */
        srclen = strcspn(cp, ",=\r\n");
-       srclen = max(srclen, (size_t)(cpend - cp));
+       srclen = min(srclen, (size_t)(cpend - cp));
        len = srclen;
        while (len > 0 && isspace(cp[len - 1]))
                len--;
@@ -2793,7 +2793,7 @@ nextvar(
         * Return this.  All done.
         */
        if (np < cpend)
-               np++;
+               np++;           /* over ',' */
        *datap = np;
        *datalen = cpend - np;
        *vvalue = value;