diff options
author | Niall O'Reilly <Niall.oReilly@ucd.ie> | 2019-09-19 14:38:14 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2019-09-19 22:50:38 +0200 |
commit | 0d59addff6af9d32b7b92b61ebd74915c2ff13e8 (patch) | |
tree | 1ffdbac666ec78ec94829b20c88af7d4c9eaab89 /lib/doh.c | |
parent | 0a4ecbdf1c35de3a0a367db73edbf50fabc0fb0e (diff) | |
download | curl-0d59addff6af9d32b7b92b61ebd74915c2ff13e8.tar.gz |
doh: avoid truncating DNS QTYPE to lower octet
Closes #4381
Diffstat (limited to 'lib/doh.c')
-rw-r--r-- | lib/doh.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -135,8 +135,10 @@ UNITTEST DOHcode doh_encode(const char *host, } } while(1); - *dnsp++ = '\0'; /* upper 8 bit TYPE */ - *dnsp++ = (unsigned char)dnstype; + /* There are assigned TYPE codes beyond 255: use range [1..65535] */ + *dnsp++ = (unsigned char)(255 & (dnstype>>8)); /* upper 8 bit TYPE */ + *dnsp++ = (unsigned char)(255 & dnstype); /* lower 8 bit TYPE */ + *dnsp++ = '\0'; /* upper 8 bit CLASS */ *dnsp++ = DNS_CLASS_IN; /* IN - "the Internet" */ |