resolved: fix rcode formatting string length
authorLennart Poettering <lennart@poettering.net>
Fri, 22 Jan 2016 11:04:36 +0000 (12:04 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 25 Jan 2016 16:19:19 +0000 (17:19 +0100)
Since we honour the edns rcode extension we need more than 4 bits to format it. To avoid further confusion, derive the
right length from the type.

src/resolve/resolved-bus.c

index bc2d6dd..2cb6228 100644 (file)
@@ -69,7 +69,7 @@ static int reply_query_state(DnsQuery *q) {
                         sd_bus_error_setf(&error, _BUS_ERROR_DNS "NXDOMAIN", "'%s' not found", dns_query_string(q));
                 else {
                         const char *rc, *n;
-                        char p[3]; /* the rcode is 4 bits long */
+                        char p[DECIMAL_STR_MAX(q->answer_rcode)];
 
                         rc = dns_rcode_to_string(q->answer_rcode);
                         if (!rc) {