summaryrefslogtreecommitdiffstats
path: root/contrib/bind/lib/nameser/ns_samedomain.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bind/lib/nameser/ns_samedomain.c')
-rw-r--r--contrib/bind/lib/nameser/ns_samedomain.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/contrib/bind/lib/nameser/ns_samedomain.c b/contrib/bind/lib/nameser/ns_samedomain.c
index da6f3b6..6394701 100644
--- a/contrib/bind/lib/nameser/ns_samedomain.c
+++ b/contrib/bind/lib/nameser/ns_samedomain.c
@@ -16,7 +16,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$Id: ns_samedomain.c,v 8.9.6.2 2002/11/14 22:36:46 marka Exp $";
+static const char rcsid[] = "$Id: ns_samedomain.c,v 8.10.8.1 2003/06/02 05:05:05 marka Exp $";
#endif
#include "port_before.h"
@@ -125,12 +125,12 @@ ns_samedomain(const char *a, const char *b) {
*/
escaped = 0;
for (i = diff - 2; i >= 0; i--)
- if (a[i] == '\\')
+ if (a[i] == '\\') {
if (escaped)
escaped = 0;
else
escaped = 1;
- else
+ } else
break;
if (escaped)
return (0);
@@ -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';
OpenPOWER on IntegriCloud