]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 3667] decodenetnum fails with numeric port
authorJuergen Perlinger <perlinger@ntp.org>
Mon, 25 May 2020 10:42:46 +0000 (12:42 +0200)
committerJuergen Perlinger <perlinger@ntp.org>
Mon, 25 May 2020 10:42:46 +0000 (12:42 +0200)
 - windows compilation issues

bk: 5ecba126vqehAvmc7RBAUU2ULCOEFg

libntp/decodenetnum.c
libntp/strdup.c
ports/winnt/include/config.h

index d8a7296e4b048eee8ea89bcd1b78ef61940204bd..8ff67625202c7d34bd7ee0c1a7c6d86af58fe3d2 100644 (file)
@@ -91,7 +91,7 @@ decodenetnum(
        char            buf[64];        /* working copy of input */
        char            *haddr=buf;
        unsigned int    port=NTP_PORT, scope=0;
-       sa_family_t     afam=AF_UNSPEC;
+       unsigned short  afam=AF_UNSPEC;
        
        /* copy input to working buffer with length check */
        if (strlcpy(buf, num, sizeof(buf)) >= sizeof(buf))
index 5d9d738767215121c222d780ea5812cedee4df42..8af9ff81b39cb4787ce9db99f8752175b4bacb2b 100644 (file)
@@ -1,8 +1,8 @@
 #include <config.h>
 
 #include <ntp_assert.h>
-#include "ntp_malloc.h"
 #include <string.h>
+#include "ntp_malloc.h"
 #include "l_stdlib.h"
 
 #define STRDUP_EMPTY_UNIT
@@ -32,12 +32,12 @@ strdup(
 # undef STRDUP_EMPTY_UNIT
 void *memchr(const void *s, int c, size_t n)
 {
-       const unsignec char *p = s;
+       const unsigned char *p = s;
        while (n && *p != c) {
                --n;
                ++p;
        }
-       return n ? p : NULL;
+       return n ? (char*)p : NULL;
 }
 #endif
 
index 6f70bd3ceff7567e961ef66f12a3bc563e7ce524..17526c266434dce5866be26f78c6e6618df4a01c 100644 (file)
@@ -411,6 +411,8 @@ typedef int ssize_t;        /* ssize is an int */
 # define HAVE_SETVBUF                  1
 # define HAVE_STRCHR                   1       /* for libopts */
 # define HAVE_STRDUP                   1
+# define HAVE_STRNLEN                  1
+# define HAVE_MEMCHR                   1
 # define HAVE_TIMEGM                   1       /* actually _mkgmtime */
 
 # define HAVE_STRUCT_TIMESPEC