]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
kdig: be careful about the received EDNS EXPIRE value
authorDavid Vašek <david.vasek@nic.cz>
Mon, 3 Apr 2023 22:14:49 +0000 (00:14 +0200)
committerDaniel Salzman <daniel.salzman@nic.cz>
Tue, 4 Apr 2023 05:30:42 +0000 (07:30 +0200)
src/utils/common/exec.c

index afe026fa78a68bcdf96c4b631382b7da649ca3b9..dfecd9af80f0e7fb89242773c2ccd881134beaf0 100644 (file)
@@ -278,8 +278,11 @@ static void print_expire(const uint8_t *data, uint16_t len)
        } else {
                char str[80] = "";
                uint32_t timer = knot_wire_read_u32(data);
-               knot_time_print_human(timer, str, sizeof(str), false);
-               printf("%u (%s)", timer, str);
+               if (knot_time_print_human(timer, str, sizeof(str), false) > 0) {
+                       printf("%u (%s)", timer, str);
+               } else {
+                       printf("%u", timer);
+               }
        }
 }