]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Skip the trailing . if it exists on the FQDN.
authorRoy Marples <roy@marples.name>
Fri, 8 Aug 2008 11:31:19 +0000 (11:31 +0000)
committerRoy Marples <roy@marples.name>
Fri, 8 Aug 2008 11:31:19 +0000 (11:31 +0000)
dhcp.c

diff --git a/dhcp.c b/dhcp.c
index 0f8a1724dbf684cf4f11da19661d9cfc408ea419..6c93c791b5af3cbb578758defb582ddd8669ec1d 100644 (file)
--- a/dhcp.c
+++ b/dhcp.c
@@ -712,8 +712,11 @@ encode_rfc1035(const char *src, uint8_t *dst, size_t len)
                if (*c == '\0')
                        break;
                if (*c == '.') {
+                       /* Skip the trailing . */
+                       if (c == src + len - 1)
+                               break;
                        *lp = p - lp - 1;
-                       if (*lp == 0)
+                       if (*lp == '\0')
                                return p - dst;
                        lp = p++;
                } else