diff --git a/src/util/dnsmasq.c b/src/util/dnsmasq.c
index 4f210d2130..de0293a565 100644
--- a/src/util/dnsmasq.c
+++ b/src/util/dnsmasq.c
@@ -641,9 +641,9 @@ dnsmasqCapsSetFromBuffer(dnsmasqCapsPtr caps, const char *buf)
 
     caps->noRefresh = true;
 
-    p = STRSKIP(buf, DNSMASQ_VERSION_STR);
-    if (!p)
+    if (!(p = strstr(buf, DNSMASQ_VERSION_STR)))
        goto fail;
+    p += sizeof(DNSMASQ_VERSION_STR) - 1;
     virSkipSpaces(&p);
     if (virParseVersionString(p, &caps->version, true) < 0)
         goto fail;