From: Tollef Fog Heen Date: Mon, 12 Oct 2009 09:14:18 +0000 (+0200) Subject: Initialise more variables to NULL X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c9f3ef39795380e020a2fa129a89357419ab5ac7;p=yubikey-server-c Initialise more variables to NULL --- diff --git a/src/main.c b/src/main.c index 05d037f..e704da6 100644 --- a/src/main.c +++ b/src/main.c @@ -109,6 +109,7 @@ char *sign_request(char *key, size_t key_len, char *info, char *status, } else { asprintf(&line, "status=%s×tamp=%s", status, timestamp); } + /* XXX Check memory allocation */ gcry_md_open(&hd, GCRY_MD_SHA1, GCRY_MD_FLAG_HMAC); gcry_md_setkey(hd, key, key_len); gcry_md_write(hd, line, strlen(line)); @@ -338,13 +339,14 @@ static int handle_request(void * UNUSED(data), void **UNUSED(con_cls)) { const char *id = NULL, *otp = NULL, *h = NULL; - char *uid, *otp_token; + char *uid = NULL, *otp_token = NULL; char *signature = NULL, *status = NULL, *info = NULL, *timestamp = NULL; char *shared_secret; size_t shared_secret_len; yubikey_token_st token; struct ykc_stats stats; memset(&token, '\0', sizeof(token)); + memset(&stats, '\0', sizeof(stats)); timestamp = get_timestamp(); assert(timestamp != NULL);