diff --git a/lib/cf-socket.c b/lib/cf-socket.c index 737f6298ba..3e87889f9c 100644 --- a/lib/cf-socket.c +++ b/lib/cf-socket.c @@ -1279,7 +1279,7 @@ static ssize_t cf_socket_send(struct Curl_cfilter *cf, struct Curl_easy *data, #ifdef DEBUGBUILD /* simulate network blocking/partial writes */ if(ctx->wblock_percent > 0) { - unsigned char c; + unsigned char c = 0; Curl_rand(data, &c, 1); if(c >= ((100-ctx->wblock_percent)*256/100)) { CURL_TRC_CF(data, cf, "send(len=%zu) SIMULATE EWOULDBLOCK", orig_len); @@ -1357,7 +1357,7 @@ static ssize_t cf_socket_recv(struct Curl_cfilter *cf, struct Curl_easy *data, #ifdef DEBUGBUILD /* simulate network blocking/partial reads */ if(cf->cft != &Curl_cft_udp && ctx->rblock_percent > 0) { - unsigned char c; + unsigned char c = 0; Curl_rand(data, &c, 1); if(c >= ((100-ctx->rblock_percent)*256/100)) { CURL_TRC_CF(data, cf, "recv(len=%zu) SIMULATE EWOULDBLOCK", len); diff --git a/lib/curl_gethostname.c b/lib/curl_gethostname.c index 706b2e6892..bd9b220d49 100644 --- a/lib/curl_gethostname.c +++ b/lib/curl_gethostname.c @@ -68,7 +68,7 @@ int Curl_gethostname(char * const name, GETHOSTNAME_TYPE_ARG2 namelen) /* Override host name when environment variable CURL_GETHOSTNAME is set */ const char *force_hostname = getenv("CURL_GETHOSTNAME"); if(force_hostname) { - strncpy(name, force_hostname, namelen); + strncpy(name, force_hostname, namelen - 1); err = 0; } else { diff --git a/lib/hostip.c b/lib/hostip.c index 4b7ac2577f..93c36e031b 100644 --- a/lib/hostip.c +++ b/lib/hostip.c @@ -244,7 +244,7 @@ void Curl_hostcache_prune(struct Curl_easy *data) if(data->share) Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE); - time(&now); + now = time(NULL); do { /* Remove outdated and unused entries from the hostcache */ @@ -298,7 +298,7 @@ static struct Curl_dns_entry *fetch_addr(struct Curl_easy *data, /* See whether the returned entry is stale. Done before we release lock */ struct hostcache_prune_data user; - time(&user.now); + user.now = time(NULL); user.cache_timeout = data->set.dns_cache_timeout; user.oldest = 0; diff --git a/lib/tftp.c b/lib/tftp.c index 09355f1e6e..310a0faba7 100644 --- a/lib/tftp.c +++ b/lib/tftp.c @@ -1204,7 +1204,7 @@ static timediff_t tftp_state_timeout(struct Curl_easy *data, state->state = TFTP_STATE_FIN; return 0; } - time(¤t); + current = time(NULL); if(current > state->rx_time + state->retry_time) { if(event) *event = TFTP_EVENT_TIMEOUT;