]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 710] compat getnameinfo() has off-by-one error
authorHarlan Stenn <stenn@ntp.org>
Sat, 16 Sep 2006 19:00:36 +0000 (15:00 -0400)
committerHarlan Stenn <stenn@ntp.org>
Sat, 16 Sep 2006 19:00:36 +0000 (15:00 -0400)
bk: 450c49d4bd3HeYfRU6p6ngd32Mku1Q

libntp/ntp_rfc2553.c

index e63781cb2089bfe66eeb3e4375683ab22d819e3c..ddd421d073ca144b69c3d6686cb2bafe3be7b6a6 100644 (file)
@@ -302,7 +302,7 @@ getnameinfo (const struct sockaddr *sa, u_int salen, char *host,
        }
        if (host != NULL) {
                strncpy(host, hp->h_name, hostlen);
-               host[hostlen] = '\0';
+               host[hostlen - 1] = '\0';
        }
        return (0);
 }