Index: uspace/srv/net/dnsres/dns_msg.c
===================================================================
--- uspace/srv/net/dnsres/dns_msg.c	(revision 9d8bd3accd69b5e61a1be9ba5b222a6918fbe170)
+++ uspace/srv/net/dnsres/dns_msg.c	(revision f1dcf6dc78256466b2546940d33f3fea01b85904)
@@ -47,4 +47,6 @@
 #define NAME  "dnsres"
 
+static uint16_t dns_uint16_t_decode(uint8_t *, size_t);
+
 #include <stdio.h>
 static int dns_name_encode(char *name, uint8_t *buf, size_t buf_size,
@@ -117,4 +119,6 @@
 	size_t lsize;
 	size_t i;
+	size_t ptr;
+	size_t eptr;
 
 	if (boff > size)
@@ -129,5 +133,4 @@
 		}
 
-
 		lsize = *bp;
 		++bp;
@@ -137,11 +140,33 @@
 			break;
 
-		if (bp != buf + 1)
+		if (bp != buf + boff + 1)
 			printf(".");
 
 		if ((lsize & 0xc0) == 0xc0) {
+			printf("Pointer\n");
 			/* Pointer */
-			printf("compression not supported!\n");
-			return EINVAL;
+			if (bsize < 1) {
+				printf("Pointer- bsize < 1\n");
+				return EINVAL;
+			}
+
+			ptr = dns_uint16_t_decode(bp - 1, bsize) & 0x3fff;
+			if (ptr >= (size_t)(bp - buf)) {
+				printf("Pointer- forward ref %u, pos=%u\n",
+				    ptr, bp - buf);
+				/* Forward reference */
+				return EINVAL;
+			}
+
+			/*
+			 * Make sure we will not decode any byte twice.
+			 * XXX Is assumption correct?
+			 */
+			eptr = buf - bp;
+
+			printf("ptr=%u, eptr=%u\n", ptr, eptr);
+			bp = buf + ptr;
+			bsize = eptr - ptr;
+			continue;
 		}
 
