curl-library
Re: [PATCH curl 1/6] sasl: allow arbitrarily long username and password
From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 19 Aug 2013 16:40:05 +0200 (CEST)
Date: Mon, 19 Aug 2013 16:40:05 +0200 (CEST)
On Mon, 19 Aug 2013, Jonathan Nieder wrote:
> + char *response = NULL;
> + size_t responselen;
> +
> + responselen = strlen(userp) + 2 * MD5_DIGEST_LEN + 2;
> + response = malloc(responselen);
> + snprintf(response, responselen,
> "%s %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
> userp, digest[0], digest[1], digest[2], digest[3], digest[4],
I'm thinking perhaps this would become slightly nicer with using aprintf()
instead since this isn't really performance critical code?
Like:
response = aprintf("%s%02x%02x%02x%02x%02x" ...);
if(!response)
bail_out...
-- / daniel.haxx.se ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2013-08-19