]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
octal values were read and printed as decimal values
authorJelte Jansen <jeltejan@NLnetLabs.nl>
Mon, 14 Nov 2005 15:08:03 +0000 (15:08 +0000)
committerJelte Jansen <jeltejan@NLnetLabs.nl>
Mon, 14 Nov 2005 15:08:03 +0000 (15:08 +0000)
host2str.c
str2host.c

index f4b68af9c48647400c1f21e25ff91a462f8f4bf5..0e317612e0e9e2b59108842eddb824329a5f999d 100644 (file)
@@ -113,7 +113,7 @@ ldns_rdf2buffer_str_dname(ldns_buffer *output, ldns_rdf *dname)
                                        ldns_buffer_printf(output, "\\%c", data[src_pos]);
                                        /* isprint!? */
                                } else if (!isprint((int) data[src_pos])) {
-                                       ldns_buffer_printf(output, "\\%03u", data[src_pos]);
+                                       ldns_buffer_printf(output, "\\%03o", data[src_pos]);
                                } else {
                                        ldns_buffer_printf(output, "%c", data[src_pos]);
                                }
index 8ea7cc144d51a5af7bb9f2dc4cdcfe661dce066a..4da7669e580d84d0bb4e0f483d75c4e53372f18f 100644 (file)
@@ -206,8 +206,8 @@ ldns_str2rdf_dname(ldns_rdf **d, const char *str)
                            isdigit((int) s[2]) &&
                            isdigit((int) s[3])) {
                                /* cast this so it fits */
-                               val = (uint8_t) ldns_hexdigit_to_int((char) s[1]) * 100 +
-                                               ldns_hexdigit_to_int((char) s[2]) * 10 +
+                               val = (uint8_t) ldns_hexdigit_to_int((char) s[1]) * 64 +
+                                               ldns_hexdigit_to_int((char) s[2]) * 8 +
                                                ldns_hexdigit_to_int((char) s[3]);
                                *q = val;
                                s += 3;