X-Git-Url: https://git.piment-noir.org/?p=deb_shairplay.git;a=blobdiff_plain;f=src%2Flib%2Fdigest.c;fp=src%2Flib%2Fdigest.c;h=58c857835d96ae36570cb5cba90a81153599f629;hp=78c916ea51dd03e94575fb53db00abc7bc4e69ee;hb=aaf0290d2e892ed2edb16441495094abb45e6fa6;hpb=aab90761cc68dfa33e13187e212eeea29a8da4fd diff --git a/src/lib/digest.c b/src/lib/digest.c index 78c916e..58c8578 100644 --- a/src/lib/digest.c +++ b/src/lib/digest.c @@ -128,22 +128,25 @@ digest_is_valid(const char *our_realm, const char *password, else *last = '\0'; /* Store value if it is relevant */ - if (!strncmp("username=\"", first, 10)) + if (!strncmp("username=\"", first, 10)) { username = first+10; - if (!strncmp("realm=\"", first, 7)) + } else if (!strncmp("realm=\"", first, 7)) { realm = first+7; - if (!strncmp("nonce=\"", first, 7)) + } else if (!strncmp("nonce=\"", first, 7)) { nonce = first+7; - if (!strncmp("uri=\"", first, 5)) + } else if (!strncmp("uri=\"", first, 5)) { uri = first+5; - if (!strncmp("response=\"", first, 10)) + } else if (!strncmp("response=\"", first, 10)) { response = first+10; + } } if (!username || !realm || !nonce || !uri || !response) { + free(auth); return 0; } if (strcmp(realm, our_realm) || strcmp(nonce, our_nonce) || strcmp(uri, our_uri)) { + free(auth); return 0; }