]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix some minor Bonjour issues - wasn't reading to the end of the TXT record, and
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Mon, 26 Sep 2011 18:46:36 +0000 (18:46 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Mon, 26 Sep 2011 18:46:36 +0000 (18:46 +0000)
need to better handle "rp" values.

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@10016 7a7537e8-13f0-0310-91df-b6672ffda945

backend/dnssd.c
cups/http-support.c

index e8de61c254c9a288566ee466268fbb77d2557438..fd86e08148e4ccab28e8497e84161ed1b2c88b63 100644 (file)
@@ -774,7 +774,7 @@ query_callback(
 
         datalen = *data++;
 
-        if (!datalen || (data + datalen) >= dataend)
+        if (!datalen || (data + datalen) > dataend)
          break;
 
         datanext = data + datalen;
index 6d2e77548fb4f66a904bc797319ff47c336f9a11..877d177b321a0cf6a2ff082c0fb0a6626d58d804 100644 (file)
@@ -1823,17 +1823,36 @@ http_resolve_cb(
 
   if ((value = TXTRecordGetValuePtr(txtLen, txtRecord, "rp",
                                     &valueLen)) != NULL)
+  {
+    if (((char *)value)[0] == '/')
+    {
+     /*
+      * "rp" value (incorrectly) has a leading slash already...
+      */
+
+      memcpy(rp, value, valueLen);
+      rp[valueLen] = '\0';
+    }
+    else
+    {
+     /*
+      * Convert to resource by concatenating with a leading "/"...
+      */
+
+      rp[0] = '/';
+      memcpy(rp + 1, value, valueLen);
+      rp[valueLen + 1] = '\0';
+    }
+  }
+  else
   {
    /*
-    * Convert to resource by concatenating with a leading "/"...
+    * Default "rp" value is blank, mapping to a path of "/"...
     */
 
     rp[0] = '/';
-    memcpy(rp + 1, value, valueLen);
-    rp[valueLen + 1] = '\0';
+    rp[1] = '\0';
   }
-  else
-    rp[0] = '\0';
 
  /*
   * Lookup the FQDN if needed...