Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/iperf_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -3790,7 +3790,7 @@ iperf_print_intermediate(struct iperf_test *test)
/* Print stream role just for bidirectional mode. */

if (test->mode == BIDIRECTIONAL) {
sprintf(mbuf, "[%s-%s]", stream_must_be_sender?"TX":"RX", test->role == 'c'?"C":"S");
snprintf(mbuf, sizeof(mbuf), "[%s-%s]", stream_must_be_sender?"TX":"RX", test->role == 'c'?"C":"S");
} else {
mbuf[0] = '\0';
zbuf[0] = '\0';
Expand Down Expand Up @@ -3992,7 +3992,7 @@ iperf_print_results(struct iperf_test *test)
/* Print stream role just for bidirectional mode. */

if (test->mode == BIDIRECTIONAL) {
sprintf(mbuf, "[%s-%s]", stream_must_be_sender?"TX":"RX", test->role == 'c'?"C":"S");
snprintf(mbuf, sizeof(mbuf), "[%s-%s]", stream_must_be_sender?"TX":"RX", test->role == 'c'?"C":"S");
} else {
mbuf[0] = '\0';
}
Expand Down Expand Up @@ -4484,7 +4484,7 @@ print_interval_results(struct iperf_test *test, struct iperf_stream *sp, cJSON *
double bandwidth, lost_percent;

if (test->mode == BIDIRECTIONAL) {
sprintf(mbuf, "[%s-%s]", sp->sender?"TX":"RX", test->role == 'c'?"C":"S");
snprintf(mbuf, sizeof(mbuf), "[%s-%s]", sp->sender?"TX":"RX", test->role == 'c'?"C":"S");
} else {
mbuf[0] = '\0';
zbuf[0] = '\0';
Expand Down
1 change: 0 additions & 1 deletion src/iperf_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ long get_rttvar(struct iperf_interval_results *irp);
long get_pmtu(struct iperf_interval_results *irp);
long get_reorder(struct iperf_interval_results *irp);
void print_tcpinfo(struct iperf_test *test);
void build_tcpinfo_message(struct iperf_interval_results *r, char *message);

int iperf_set_send_state(struct iperf_test *test, signed char state);
void iperf_check_throttle(struct iperf_stream *sp, struct iperf_time *nowP);
Expand Down
4 changes: 2 additions & 2 deletions src/iperf_auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void sha256(const char *string, char outputBuffer[65])
int i = 0;
for(i = 0; i < SHA256_DIGEST_LENGTH; i++)
{
sprintf(outputBuffer + (i * 2), "%02x", hash[i]);
snprintf(outputBuffer + (i * 2), 3, "%02x", hash[i]);
}
outputBuffer[64] = 0;
}
Expand All @@ -74,7 +74,7 @@ int check_authentication(const char *username, const char *password, const time_

char passwordHash[65];
char salted[strlen(username) + strlen(password) + 3];
sprintf(salted, "{%s}%s", username, password);
snprintf(salted, sizeof(salted), "{%s}%s", username, password);
sha256(&salted[0], passwordHash);

char *s_username, *s_password;
Expand Down
15 changes: 0 additions & 15 deletions src/tcp_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,18 +235,3 @@ get_reorder(struct iperf_interval_results *irp)
#endif
}

/*************************************************************/
void
build_tcpinfo_message(struct iperf_interval_results *r, char *message)
{
#if defined(linux) && defined(TCP_INFO)
sprintf(message, report_tcpInfo, r->tcpInfo.tcpi_snd_cwnd, r->tcpInfo.tcpi_snd_ssthresh,
r->tcpInfo.tcpi_rcv_ssthresh, r->tcpInfo.tcpi_unacked, r->tcpInfo.tcpi_sacked,
r->tcpInfo.tcpi_lost, r->tcpInfo.tcpi_retrans, r->tcpInfo.tcpi_fackets,
r->tcpInfo.tcpi_rtt, r->tcpInfo.tcpi_reordering);
#endif
#if (defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)) && defined(TCP_INFO)
sprintf(message, report_tcpInfo, r->tcpInfo.tcpi_snd_cwnd,
r->tcpInfo.tcpi_rcv_space, r->tcpInfo.tcpi_snd_ssthresh, r->tcpInfo.tcpi_rtt);
#endif
}