Netgear / wsdd2

WSD/LLMNR Discovery/Name Service Daemon
GNU General Public License v3.0
153 stars 34 forks source link

-b cannot be used to provide urls #16

Open tmm1 opened 3 years ago

tmm1 commented 3 years ago
# wsdd2 -b "vendorurl:https://example.com"
bad key:val '://example.com'

On https://docs.microsoft.com/en-us/windows/win32/api/wsdtypes/ns-wsdtypes-wsd_this_model_metadata you can see urls are expected:

<wsd:ManufacturerURL>
    http://www.adatum.com
</wsd:ManufacturerURL>
xnoreq commented 2 years ago

Patch:

---
 wsd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/wsd.c b/wsd.c
index 0b4b3d2..3593aa8 100644
--- a/wsd.c
+++ b/wsd.c
@@ -214,9 +214,9 @@ int set_getresp(const char *str, const char **next)
        val = p;

        /* Look for end of value. */
-       while (*p && *p != ':' && *p != ',')
+       while (*p && *p != ',')
                p++;
-       if (*p && *p != ',')
+       if (*p)
                goto exit;

        vallen = p - val;
@@ -225,7 +225,7 @@ int set_getresp(const char *str, const char **next)

        /* Look for key in lookup table. */
        for (i = 0; bootinfo[i].key; i++)
-               if (!strncasecmp(bootinfo[i].key, str, keylen))
+               if (keylen == strlen(bootinfo[i].key) - 1 && !strncasecmp(bootinfo[i].key, str, keylen))
                        break;

        if (!bootinfo[i].key)
--