diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2021-11-03 20:38:23 +0000 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2021-11-03 20:38:23 +0000 |
commit | c37de334631ca74fd7a8bccf67393b50463aaaf8 (patch) | |
tree | a76683853e00478f86cac3a56f4eb560c3221892 /sys/src/cmd/ndb | |
parent | 6285c19b3325e77c9056c369de1d64dd5132cb56 (diff) |
ndb/dns: use decimal encoding for txt rr string escapes
rfc883 suggests to use decimal digits to escape txt rr strings,
and unix dig appears to use the same.
so change from octal to decimal.
Diffstat (limited to 'sys/src/cmd/ndb')
-rw-r--r-- | sys/src/cmd/ndb/dblookup.c | 6 | ||||
-rw-r--r-- | sys/src/cmd/ndb/dn.c | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/sys/src/cmd/ndb/dblookup.c b/sys/src/cmd/ndb/dblookup.c index 0d5458778..432abc48e 100644 --- a/sys/src/cmd/ndb/dblookup.c +++ b/sys/src/cmd/ndb/dblookup.c @@ -459,10 +459,10 @@ txtrr(Ndbtuple*, Ndbtuple *pair) for(i = 0; i < n && sofar < len; i++){ uint c = pair->val[sofar++]; if(c == '\\' && sofar < len){ - if(pair->val[sofar] >= '0' && pair->val[sofar] <= '7'){ + if(pair->val[sofar] >= '0' && pair->val[sofar] <= '9'){ c = pair->val[sofar++] - '0'; - while(pair->val[sofar] >= '0' && pair->val[sofar] <= '7') - c = (c << 3) | (pair->val[sofar++] - '0'); + while(pair->val[sofar] >= '0' && pair->val[sofar] <= '9') + c = (c * 10) + (pair->val[sofar++] - '0'); } else { c = pair->val[sofar++]; } diff --git a/sys/src/cmd/ndb/dn.c b/sys/src/cmd/ndb/dn.c index 377fdd987..2fbbb50c6 100644 --- a/sys/src/cmd/ndb/dn.c +++ b/sys/src/cmd/ndb/dn.c @@ -1201,7 +1201,7 @@ idnname(DN *dn, char *buf, int nbuf) * control characters and double quotes (") which would * collide with ndb(6) format. * escape special characters by encoding them as: \DDD - * where D is a octal digit. backslash (\) is escaped + * where D is a decimal digit. backslash (\) is escaped * by doubling. valid utf8 is encoded verbatim. */ int @@ -1227,7 +1227,7 @@ bslashfmt(Fmt *f) } c = *data; if(c < ' ' || c == '"' || c > '~') - out += fmtprint(f, "\\%.3o", c); + out += fmtprint(f, "\\%.3d", c); else if(c == '\\') out += fmtprint(f, "\\\\"); else |