summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-12-21 20:52:24 +1100
committerAndrew Tridgell <tridge@samba.org>2010-12-21 11:18:20 +0100
commite7b1acaddf2ccc7de0301cc67f72187ab450e7b5 (patch)
treec9763f18ab918a1ff8fce3fa324881603f59cb52
parent8466027bf91b83076b5d42b6d8cee90897930c1c (diff)
downloadsamba-e7b1acaddf2ccc7de0301cc67f72187ab450e7b5.tar.gz
samba-e7b1acaddf2ccc7de0301cc67f72187ab450e7b5.tar.bz2
samba-e7b1acaddf2ccc7de0301cc67f72187ab450e7b5.zip
dns: cope with trailing '.' in dns_name
-rw-r--r--librpc/ndr/ndr_dnsp.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/librpc/ndr/ndr_dnsp.c b/librpc/ndr/ndr_dnsp.c
index ae78425c55..daf8fffdef 100644
--- a/librpc/ndr/ndr_dnsp.c
+++ b/librpc/ndr/ndr_dnsp.c
@@ -95,7 +95,13 @@ enum ndr_err_code ndr_push_dnsp_name(struct ndr_push *ndr, int ndr_flags, const
for (count=i=0; name[i]; i++) {
if (name[i] == '.') count++;
}
- total_len = strlen(name) + 1 + 1;
+ total_len = strlen(name) + 1;
+
+ /* cope with names ending in '.' */
+ if (name[strlen(name)-1] != '.') {
+ total_len++;
+ count++;
+ }
if (total_len > 255 || count > 255) {
return ndr_push_error(ndr, NDR_ERR_BUFSIZE,
"dns_name of length %d larger than 255", total_len);