From: Alan T. DeKok Date: Wed, 19 Oct 2011 14:54:40 +0000 (+0200) Subject: Fix sizeof() checks found by coverity X-Git-Tag: release_3_0_0_beta0~570 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0465bee0201576b4bef06086337469ebadfd8be3;p=thirdparty%2Ffreeradius-server.git Fix sizeof() checks found by coverity --- diff --git a/src/main/realms.c b/src/main/realms.c index a4b3a7fd653..e61b681be8f 100644 --- a/src/main/realms.c +++ b/src/main/realms.c @@ -1081,7 +1081,7 @@ static int server_pool_add(realm_config_t *rc, value = cf_pair_value(cp); - memset(&myhome, 0, sizeof(&myhome)); + memset(&myhome, 0, sizeof(myhome)); myhome.name = value; myhome.type = server_type; diff --git a/src/modules/rlm_otp/otp_radstate.c b/src/modules/rlm_otp/otp_radstate.c index b896413d10d..9e60f0024bd 100644 --- a/src/modules/rlm_otp/otp_radstate.c +++ b/src/modules/rlm_otp/otp_radstate.c @@ -97,7 +97,7 @@ otp_gen_state(char rad_state[OTP_MAX_RADSTATE_LEN], * DES, so we'll use it's hmac functionality also -- saves us from * having to collect the data to be signed into one contiguous piece. */ - HMAC_Init(&hmac_ctx, key, sizeof(key), EVP_md5()); + HMAC_Init(&hmac_ctx, key, sizeof(key[0] * 16), EVP_md5()); HMAC_Update(&hmac_ctx, challenge, clen); HMAC_Update(&hmac_ctx, (unsigned char *) &flags, 4); HMAC_Update(&hmac_ctx, (unsigned char *) &when, 4); diff --git a/src/modules/rlm_perl/rlm_perl.c b/src/modules/rlm_perl/rlm_perl.c index 8acb1f09d3f..c00e31c64e8 100644 --- a/src/modules/rlm_perl/rlm_perl.c +++ b/src/modules/rlm_perl/rlm_perl.c @@ -417,8 +417,8 @@ static int perl_instantiate(CONF_SECTION *conf, void **instance) const char *xlat_name; int exitstatus = 0, argc=0; - embed = rad_malloc(4*(sizeof(char *))); - memset(embed, 0, sizeof(4*(sizeof(char *)))); + embed = rad_malloc(4 * sizeof(char *)); + memset(embed, 0, 4 *sizeof(char *)); /* * Set up a storage area for instance data */