1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-05 06:52:22 +03:00

resolved: various fixes regarding encoding of UTF8 characters in DNS RRs

This commit is contained in:
Lennart Poettering 2014-07-31 19:51:11 +02:00
parent fd0b4602f6
commit 07bed172ed

View File

@ -88,7 +88,7 @@ int dns_label_unescape(const char **name, char *dest, size_t sz) {
} else
return -EINVAL;
} else if (*n >= ' ' && *n != 127) {
} else if ((uint8_t) *n >= (uint8_t) ' ' && *n != 127) {
/* Normal character */
*(d++) = *(n++);
@ -141,13 +141,13 @@ int dns_label_escape(const char *p, size_t l, char **ret) {
/* Proper character */
*(q++) = *p;
} else if (*p >= ' ' && *p != 127) {
} else if ((uint8_t) *p >= (uint8_t) ' ' && *p != 127) {
/* Everything else */
*(q++) = '\\';
*(q++) = '0' + (char) ((unsigned) *p / 100);
*(q++) = '0' + (char) (((unsigned) *p / 10) % 10);
*(q++) = '0' + (char) ((unsigned) *p % 10);
*(q++) = '0' + (char) ((uint8_t) *p / 100);
*(q++) = '0' + (char) (((uint8_t) *p / 10) % 10);
*(q++) = '0' + (char) ((uint8_t) *p % 10);
} else
return -EINVAL;