From: mike Date: Mon, 26 Sep 2011 18:46:36 +0000 (+0000) Subject: Fix some minor Bonjour issues - wasn't reading to the end of the TXT record, and X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=259c1c0b611d9ba7c7f8ce6e3009ad864d4c93d9;p=thirdparty%2Fcups.git Fix some minor Bonjour issues - wasn't reading to the end of the TXT record, and 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 --- diff --git a/backend/dnssd.c b/backend/dnssd.c index e8de61c254..fd86e08148 100644 --- a/backend/dnssd.c +++ b/backend/dnssd.c @@ -774,7 +774,7 @@ query_callback( datalen = *data++; - if (!datalen || (data + datalen) >= dataend) + if (!datalen || (data + datalen) > dataend) break; datanext = data + datalen; diff --git a/cups/http-support.c b/cups/http-support.c index 6d2e77548f..877d177b32 100644 --- a/cups/http-support.c +++ b/cups/http-support.c @@ -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...