summaryrefslogtreecommitdiff
path: root/lib/bind/nameser/ns_samedomain.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bind/nameser/ns_samedomain.c')
-rw-r--r--lib/bind/nameser/ns_samedomain.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/bind/nameser/ns_samedomain.c b/lib/bind/nameser/ns_samedomain.c
index 52489309..ded6c678 100644
--- a/lib/bind/nameser/ns_samedomain.c
+++ b/lib/bind/nameser/ns_samedomain.c
@@ -16,7 +16,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$Id: ns_samedomain.c,v 1.1.2.1 2001/11/27 23:21:56 gson Exp $";
+static const char rcsid[] = "$Id: ns_samedomain.c,v 1.1.2.2 2003/06/27 03:51:43 marka Exp $";
#endif
#include "port_before.h"
@@ -166,14 +166,14 @@ int
ns_makecanon(const char *src, char *dst, size_t dstsize) {
size_t n = strlen(src);
- if (n + sizeof "." > dstsize) {
+ if (n + sizeof "." > dstsize) { /* Note: sizeof == 2 */
errno = EMSGSIZE;
return (-1);
}
strcpy(dst, src);
- while (n > 0 && dst[n - 1] == '.') /* Ends in "." */
- if (n > 1 && dst[n - 2] == '\\' && /* Ends in "\." */
- (n < 2 || dst[n - 3] != '\\')) /* But not "\\." */
+ while (n >= 1 && dst[n - 1] == '.') /* Ends in "." */
+ if (n >= 2 && dst[n - 2] == '\\' && /* Ends in "\." */
+ (n < 3 || dst[n - 3] != '\\')) /* But not "\\." */
break;
else
dst[--n] = '\0';